and3rson / django-nameko

Django wrapper for nameko microservice framework.
GNU General Public License v3.0
72 stars 21 forks source link

Solution for multiple rabbitmq servers #2

Closed horva closed 5 years ago

horva commented 7 years ago

Hi, what do you say about following usage allowing us to connect Django app to services behind multiple RabbitMQ servers with different addresses? I have this case and suggested solution would help. Let me know if you like it and I'll send you PR. Thanks

# Settings
NAMEKO_CONFIGS = {
    'default': {
        'config': {
            'AMQP_URL': 'amqp://127.0.0.1:5672/'
        },
        'pool_size': 4
    }
    'other': {
        'config': {
            'AMQP_URL': '...'
        },
        'pool_size': 2
    }
}

# Usage:
# if no argument is passed to get_pool default is used 
# should also backward compatible with old NAMEKO_CONFIG
with get_pool('other').next() as rpc:
    rpc.mailer.send_mail(foo='bar')
and3rson commented 7 years ago

Hi @horva,

Sorry for the delay. I like how it looks: it's more Django-ish rather than the current implementation. If you're still interested, I'd really love to see your implementation.

0xGosu commented 5 years ago

Hi @horva this issue has been implemented on the PR: https://github.com/and3rson/django-nameko/pull/4