feat: update

This commit is contained in:
sujit
2025-08-12 09:02:29 +05:45
parent 82c1afbc8e
commit f98cc49264
8 changed files with 66 additions and 28 deletions

View File

@@ -23,7 +23,7 @@ func (h *JSONHandler) ProcessTask(ctx context.Context, task *mq.Task) mq.Result
operation, ok := h.Payload.Data["operation"].(string)
if !ok {
return mq.Result{Error: fmt.Errorf("operation not specified")}
return mq.Result{Error: fmt.Errorf("operation not specified"), Ctx: ctx}
}
var result map[string]any
@@ -41,12 +41,12 @@ func (h *JSONHandler) ProcessTask(ctx context.Context, task *mq.Task) mq.Result
case "extract_fields":
result = h.extractFields(data)
default:
return mq.Result{Error: fmt.Errorf("unsupported operation: %s", operation)}
return mq.Result{Error: fmt.Errorf("unsupported operation: %s", operation), Ctx: ctx}
}
resultPayload, err := json.Marshal(result)
if err != nil {
return mq.Result{Error: fmt.Errorf("failed to marshal result: %w", err)}
return mq.Result{Error: fmt.Errorf("failed to marshal result: %w", err), Ctx: ctx}
}
return mq.Result{Payload: resultPayload, Ctx: ctx}