[GH-ISSUE #435] Can I get metadata from server context? #1209

Closed
opened 2026-03-07 22:07:25 +03:00 by kerem · 2 comments
Owner

Originally created by @realmicro on GitHub (Apr 15, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/435

When I Use client.EnqueueContext, the context with my metadata,
In Server, Can I get client metadata from ProcessTask 's context?

Originally created by @realmicro on GitHub (Apr 15, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/435 When I Use `client.EnqueueContext`, the context with my metadata, In Server, Can I get client metadata from `ProcessTask` 's context?
kerem closed this issue 2026-03-07 22:07:25 +03:00
Author
Owner

@hibiken commented on GitHub (Apr 15, 2022):

@realmicro thank you for the question!

The context you provide to EnqueueContext applies to the enqueue operation only (e.g. timeout/deadline for enqueue operation). If you need to provide metadata to Handler, use task payload instead.
If you have some static metadata you want to provide to handler via context, you may be able to leverage Config.BaseContext

<!-- gh-comment-id:1100449463 --> @hibiken commented on GitHub (Apr 15, 2022): @realmicro thank you for the question! The context you provide to `EnqueueContext` applies to the enqueue operation only (e.g. timeout/deadline for enqueue operation). If you need to provide metadata to Handler, use task payload instead. If you have some static metadata you want to provide to handler via context, you may be able to leverage [`Config.BaseContext`](https://pkg.go.dev/github.com/hibiken/asynq#Config.BaseContext)
Author
Owner

@realmicro commented on GitHub (Apr 16, 2022):

@hibiken OK, Thanks for your reply.
I have use task payload instead.

<!-- gh-comment-id:1100516657 --> @realmicro commented on GitHub (Apr 16, 2022): @hibiken OK, Thanks for your reply. I have use task payload instead.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#1209
No description provided.