[GH-ISSUE #291] [FEATURE REQUEST] how to enqueue from nodejs asynq 0.18 #117

Closed
opened 2026-03-02 05:18:49 +03:00 by kerem · 2 comments
Owner

Originally created by @acgfbr on GitHub (Jul 13, 2021).
Original GitHub issue: https://github.com/hibiken/asynq/issues/291

Originally assigned to: @hibiken on GitHub.

Hi, today im enqueuing from nodejs in asynq 0.17:

image

but in asynq 0.18.x payload contains special characters:

image

how to make this payload in nodejs?

Originally created by @acgfbr on GitHub (Jul 13, 2021). Original GitHub issue: https://github.com/hibiken/asynq/issues/291 Originally assigned to: @hibiken on GitHub. Hi, today im enqueuing from nodejs in asynq 0.17: ![image](https://user-images.githubusercontent.com/8755427/125537263-30f78fa5-0842-44fb-96fc-2106303ebc98.png) but in asynq 0.18.x payload contains special characters: ![image](https://user-images.githubusercontent.com/8755427/125537291-6943fd07-38fc-4017-862a-adc2e3fa3af4.png) how to make this payload in nodejs?
kerem 2026-03-02 05:18:49 +03:00
Author
Owner

@hibiken commented on GitHub (Jul 14, 2021):

Hi @acgfbr! Thanks for opening this issue :)

We've changed how we store task data in v0.18. Take a look at the following for how it's currently implemented in Go.

github.com/hibiken/asynq@c0ae62499f/internal/rdb/rdb.go (L76)
github.com/hibiken/asynq@c0ae62499f/internal/rdb/rdb.go (L130)
github.com/hibiken/asynq@c0ae62499f/internal/rdb/rdb.go (L375)
github.com/hibiken/asynq@c0ae62499f/internal/rdb/rdb.go (L424)

To give you more details, we are using protobuf to encode task message and store each task data under a key in redis.
The format of the key is "asynq:{<qname>}:t:<task_id>" where qname and task_id depends on the task.
The value under this key is HASH type in redis with the following key-value pairs:

msg: <encoded task message proto>
state: <state of the task> 
timeout: <timeout in seconds>
deadline: <deadline in unix time (seconds)>
unique_key: <task unique key (optional)>

The protocol buffer message definition is here: https://github.com/hibiken/asynq/blob/master/internal/proto/asynq.proto


In the long-term, I'd like to create a client package for different languages (https://github.com/hibiken/asynq/issues/105) but in the meantime, you need to look at the Go implementation.
If you are interested, feel free to create a npm package for asynq client in nodeJS. I'll make sure to document it in this repo and maintain it together with this Go package :)

Please let me know if you have more questions!

<!-- gh-comment-id:879523848 --> @hibiken commented on GitHub (Jul 14, 2021): Hi @acgfbr! Thanks for opening this issue :) We've changed how we store task data in v0.18. Take a look at the following for how it's currently implemented in Go. https://github.com/hibiken/asynq/blob/c0ae62499f8a9f4ba34ca02ed5f5ba08cf6f427c/internal/rdb/rdb.go#L76 https://github.com/hibiken/asynq/blob/c0ae62499f8a9f4ba34ca02ed5f5ba08cf6f427c/internal/rdb/rdb.go#L130 https://github.com/hibiken/asynq/blob/c0ae62499f8a9f4ba34ca02ed5f5ba08cf6f427c/internal/rdb/rdb.go#L375 https://github.com/hibiken/asynq/blob/c0ae62499f8a9f4ba34ca02ed5f5ba08cf6f427c/internal/rdb/rdb.go#L424 To give you more details, we are using [protobuf](https://developers.google.com/protocol-buffers) to encode task message and store each task data under a key in redis. The format of the key is `"asynq:{<qname>}:t:<task_id>"` where qname and task_id depends on the task. The value under this key is [HASH](https://redis.io/topics/data-types) type in redis with the following key-value pairs: ``` msg: <encoded task message proto> state: <state of the task> timeout: <timeout in seconds> deadline: <deadline in unix time (seconds)> unique_key: <task unique key (optional)> ``` The protocol buffer message definition is here: https://github.com/hibiken/asynq/blob/master/internal/proto/asynq.proto --- In the long-term, I'd like to create a client package for different languages (https://github.com/hibiken/asynq/issues/105) but in the meantime, you need to look at the Go implementation. If you are interested, feel free to create a npm package for asynq client in nodeJS. I'll make sure to document it in this repo and maintain it together with this Go package :) Please let me know if you have more questions!
Author
Owner

@crossworth commented on GitHub (Jul 14, 2021):

You can create a simple program using go that takes the job payload as input, enqueue it and call using exec from other programming languages.

Another approach would be to create a simple http server with go that accepts a request to enqueue a job, that way you could enqueue jobs with anything that can make a http request.

<!-- gh-comment-id:879529576 --> @crossworth commented on GitHub (Jul 14, 2021): You can create a simple program using go that takes the job payload as input, enqueue it and call using `exec` from other programming languages. Another approach would be to create a simple http server with go that accepts a request to enqueue a job, that way you could enqueue jobs with anything that can make a http request.
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#117
No description provided.