-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Change Payload to bytes & Add Wrapper around Key-Value pair payload #109
Comments
Closing this for now. |
Hey @hibiken, What was your reasoning for closing this? |
Hey @andygrunwald thanks for your comment! func NewTask(typename string, payload []byte) *Task and add a nice wrapper around the payload to make it easier to do key-value pairs like the current API supports. something like: t := NewTask("mytask", asynq.KV(map[string]interface{}{"mykey": 123})) I'll open this issue again so that it's more visible to people. In the meantime, is it possible to workaround this by storing the bytes as string in the payload? |
Thanks @hibiken.
Didn't check this yet. Need to do another test. I think the []byte payload is able to solve both. |
Related to #245 |
@andygrunwald Would you mind describing the issue you're seeing? |
Hello @hibiken I have the same issue when consumer tried to execute task with this payload:
Payload:
The full message is:
If I change key from eventType to abc in the payload everything is ok and no errors occur.
Is there any way to fix it? |
^^ UPD: I found the difference, the keys of object sorted in different way, looks like expected payload sorted alphabetically. Payload in redis queue
Payload in consumer
The problem related to php producer, json_encode method does not work as json.Marshal in golang |
@disc Thanks for updating this issue. FYI: This issue should go away in the next release. I'm currently working on redis key re-design so that we only need to move IDs around and don't need to use JSON data to remove entry from redis sets. |
Yes, I wrote PHP client for asynq, it just produces a message to the redis queue as the asynq worker expects |
That's great! I should probably document the message schema in Wiki so that people can write clients in other languages :) Related: #105 |
Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to call
GetX
method for all the values in Payload to get all the data (also need to make sure that I don't make a typo in payload key string).It'd be nice if
asynq
supported en/decoding protobuf or gob message directly so that I can load that data to an object with one method call.Describe the solution you'd like
initial proposal:
Describe alternatives you've considered
None for now.
Additional context
None for now.
The text was updated successfully, but these errors were encountered: