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

  • SEARCH
  • Home
  • 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 8172871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:55:22+00:00 2026-06-06T21:55:22+00:00

I have a logger in Celery (with RabbitMQ) and want to duplicate its work

  • 0

I have a logger in Celery (with RabbitMQ) and want to duplicate its work for emergency cases.

# tasks.py
@task
def log(message):
    with open('test.txt', 'a') as f:
        f.write(message)


# views.py
log.delay(message)

How can I make 2 instances of Celery on different machines run log() when it’s called?

Does it make sense at all to do this?

This is possible in RabbitMQ. If you have a topic-based exchange, it’s clear that one message can be put into two different queues and delivered independently to 2 receivers.

sender =>
[message, routing_key=event.logging.log] => [queue A, topic=event.#]     
                                                      => receiver 1
                                         => [queue B, topic=*.logging.*]
                                                      => receiver 2

The message will be sent to both queues, and none of them will steal the message from another one.

  • 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-06T21:55:24+00:00Added an answer on June 6, 2026 at 9:55 pm

    To do this you would have to configure the exchange to be a topic exchange (as you say):

    CELERY_QUEUES = {
       'celery': {
           'exchange': 'celerytopic',
           'exchange_type': 'topic',
           'routing_key': 'celery',
       },
    }
    

    Then you can create your backup exchange using the AMQP api:

     from celery import current_app as celery
    
     with celery.broker_connection() as conn:
         conn.default_channel.queue_declare(queue='celery.backup', durable=True)
         conn.default_channel.queue_bind(queue='celery.backup',
                                         exchange='celerytopic',
                                         routing_key='celery',
                                         durable=True)
    

    Since you already have a queue named celery you may have to delete that first:

    $ camqadm queue.delete celery
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Logger I want to mock out, but to validate log
I have logger.h file with static logger class. Then I want to add log
I have a Logger Bean that gets injected everywhere I want to log something
I've a problem with celery's logger. I have a function that renders frames. I
I have a python logger set up, using python's logging module. I want to
Using Enterprise Library 3.1, I have a logger that, once it reaches its rollSizeKB
I have a class Logger which, among other things has a method Log .
I have a Logger instance: require 'logger' logger = Logger.new( 'foo.log', 'weekly' ) I
I want to have a custom logger for my application, which of course logs
Can an OTP event manager process (e.g. a logger) have some state of its

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.