Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8623613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:19:26+00:00 2026-06-12T07:19:26+00:00

I have an existing RabbitMQ deployment that that a few Java applications are using

  • 0

I have an existing RabbitMQ deployment that that a few Java applications are using the send out log messages as string JSON objects on various channels. I would like to use Celery to consume these messages and write them to various places (e.g. DB, Hadoop, etc.).

I can see that Celery is design to be both the producer and consumer of RabbitMQ messages, since it tries to hide the mechanism by which those messages are delivered. Is there anyway to get Celery to consume messages created by another app and run jobs when they arrive?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:19:27+00:00Added an answer on June 12, 2026 at 7:19 am

    It’s currently hard to add custom consumers to the celery workers, but this is changing in the development version (to become 3.1) where I’ve added support for Consumer boot-steps.

    There’s no documentation yet as I’ve just finished implementing it, but here’s an example:

    from celery import Celery
    from celery.bin import Option
    from celery.bootsteps import ConsumerStep
    from kombu import Consumer, Exchange, Queue
    
    class CustomConsumer(ConsumerStep):
       queue = Queue('custom', Exchange('custom'), routing_key='custom')
    
       def __init__(self, c, enable_custom_consumer=False, **kwargs):
           self.enable = self.enable_custom_consumer
    
       def get_consumers(self, connection):
           return [
               Consumer(connection.channel(),
                   queues=[self.queue],
                   callbacks=[self.on_message]),
           ]
    
       def on_message(self, body, message):
           print('GOT MESSAGE: %r' % (body, ))
           message.ack()
    
    
    celery = Celery(broker='amqp://localhost//')
    celery.steps['consumer'].add(CustomConsumer)
    celery.user_options['worker'].add(
        Option('--enable-custom-consumer', action='store_true',
               help='Enable our custom consumer.'),
    )
    

    Note that the API may change in the final version, one thing that I’m not yet sure
    about is how channels are handled after get_consumer(connection).
    Currently the channel of the consumer is closed when connection is lost, and at shutdown,
    but people may want to handle channels manually. In that case there’s always the possibility
    of customizing ConsumerStep, or writing a new StartStopStep.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have existing Java application that is using Acegi for authentication/authorization. Our new web
I have existing java code and need to create Design Document based on that.
I have an existing app in which I made the mistake of using String.GetHashCode
i have existing code that generates a spreadsheet from excel using OpenXML. It works
I have existing legacy code that is using a standard form. I would like
I have existing Java EE web applications. And I also have a new Grails
I have existing code that uses CMNewProfileSearch to find then iterate over the color
I have an existing database(myDatabse) that I created with Microsoft Sql Managenent studio and
I have existing managed and unmanaged software using an ActiveX component supplied by a
I have: existing object oriented native code API (non GUI) GUI application that works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.