I'm working in Django and have installed django-celery. The celery daemon is running on my local server and accepting/executing tasks.
The last piece for me is to create a task that sends a message to an AMPQ broker on another server. The broker configuration is in my settings.py file, but I'm not clear on how to make the connection to the AMPQ server and construct the message (with header and json-encoded payload.
And now I've come to wonder whether I even need to be running celery just to send a message to an external AMQP broker.
UPDATE:
I'm using Kombu to publish to the AMQP broker, and it appears I can successfully establish the Publisher connection using the correct exchange, routing_key and exchange_type. My message must consist of a header with three key:value pairs and a json-encoded payload. I'm unclear how to construct the message.
Celery has a client-server architecture. Client side publishes messages to a broker and the server side consumes messages from the broker.
You don't need running celery to publish messages. To send messages to the broker just configure BROKER_URL option in settings.py configuration file and call delay/apply_async methods of your tasks. Celery will construct and publish the required messages.
But you need to launch Celery worker (with celeryd or celeryd_multi command) on server side to consume messages from the broker.