-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Reading from RabbitMQ queue #28
Comments
Hi. If you want to use with RabbitMQ, try below.
const celery = require("celery-node");
const worker = celery.createWorker("amqp://", "amqp://", "queue_name");
worker.register("tasks.add", (a, b) => a + b);
worker.start();
const celery = require("celery-node");
const client = celery.createClient("amqp://", "amqp://", "queue_name");
const task = client.createTask("tasks.add");
const result = task.applyAsync([1, 2]);
result.get().then(data => {
console.log(data);
client.disconnect();
}); I hope this could be helpful. |
Thanks, I can now connect to a particular queue however I don't understand how to read its payload and send that as a parameter to the task. In your example you create a task I see the implementation in the official documentation which uses |
Sorry for late. I attached sample codes that I suppose you need.
const celery = require("../../dist");
const client = celery.createClient("amqp://", "amqp://");
const url = `s3://s3url_here`
const task = client.createTask('upload-task');
const result = task.applyAsync([url]);
result.get().then(data => {
console.log(data);
client.disconnect();
});
const celery = require("../../dist");
const worker = celery.createWorker("amqp://", "amqp://");
worker.register('upload-task', (url) => {
console.log('s3upload URL here: ', url);
return url;
});
worker.start(); Just try executing
If you have any questions, I answer it as soon as possible. |
Thank you, that's similar to what I did. |
Hi,
Thank you for your work. I'm planning to use this package to get the queue messages from a RabbitMQ instance and run another Node program with message as an argument. From the documentation, I'm struggling to understand the following:
Thank you.
The text was updated successfully, but these errors were encountered: