Comments (4)
Sorry for late.
I attached sample codes that I suppose you need.
- worker
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();
});
- client
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 node client.js
after executing node worker.js
.
Then the console output would be below.
node worker.js
celery.node worker start...
registed task: upload-task
celery.node Received task: upload-task[a3ac8ec8-7924-4db1-a61a-e2a906efe797], args: s3://s3url_here, kwargs: {}
s3upload url: s3://s3url_here
celery.node Task upload-task[a3ac8ec8-7924-4db1-a61a-e2a906efe797] succeeded in 0.000260853s: s3://s3url_here
node client.js
s3://s3url_here
If you have any questions, I answer it as soon as possible.
Thank you
from celery.node.
Hi.
I'm so glad that you're planning to use it :)
If you want to use with RabbitMQ, try below.
- Worker-side
const celery = require("celery-node");
const worker = celery.createWorker("amqp://", "amqp://", "queue_name");
worker.register("tasks.add", (a, b) => a + b);
worker.start();
- Client-side
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.
from celery.node.
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 tasks.add
, and then send params [1,2]
, but I want to get the payload from a queue, which in my case is a file url in S3, and then pass that url to the worker, ideally in this way node worker.js --url some_file.csv
.
I see the implementation in the official documentation which uses channel.consume
to read the messages from queue, is there an equivalent with this library?
from celery.node.
Thank you, that's similar to what I did.
from celery.node.
Related Issues (20)
- Feature: support redis result queue expiration time to be configurable.
- Missing Process Handler
- forget method
- How to scale the worker?
- Rabbitmq backend, 50,000+ queues are created HOT 1
- RPC via RabbitMQ does not work HOT 2
- Support for flower HOT 1
- Query Regarding celery-node Support for Apache Kafka
- Could you add a new feature to support query the celery task length
- How to set workers message treatment concurrency ? HOT 5
- Add "rediss://" support HOT 1
- asyncResult created from task ID does not return anything HOT 5
- Unexpected close of worker after all the I/O intensive tasks has finished HOT 1
- inequivalent arg 'auto_delete' using the example HOT 1
- Handle `SIGTERM` signals
- Not possible to set --pool to solo HOT 1
- hope to support the function of manually ack messages.
- Have you ever used Celery not to include pool options in this library ? HOT 2
- worker start error: NotRegistered HOT 2
- Support manual routing.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from celery.node.