juntossomosmais/django-stomp

What I am doing wrong?

DavidCrediverso opened this issue · 7 comments

I have a code

AMQHOST = 'mq.website.com'
AMQPORT = '61614'
AMQUSER = 'website-int'
AMQPASS = '123456'
TOPICNAME = '/topic/website.integration.customer'

hosts = [(AMQHOST, AMQPORT)]
conn = stomp.Connection(host_and_ports=hosts, use_ssl=True)
conn.set_listener('stomp_listener', MsgListener())
conn.connect(AMQUSER, AMQPASS, wait=True, headers={'client-id': 'website'})
conn.subscribe(destination=TOPICNAME, id=1, ack='auto')
time.sleep(10)  # secs
conn.disconnect()

It's working,

but trying the same with django-stomp it's impossible to do. Please tell me what I am doing wrong.

STOMP_SERVER_HOST = 'mq.website.com'
STOMP_SERVER_PORT = '61614'
STOMP_SERVER_USER = 'website-int'
STOMP_SERVER_PASSWORD = '123456'
STOMP_USE_SSL = True
STOMP_LISTENER_CLIENT_ID = 'website'
Terminal> python3 manage.py pubsub "/topic/website.integration.customer" app.message_queue.message_queue_logic

I have error:
'User website-int is not authorized to read from: queue://DLQ.website.integration.customer'

Thanks

Hi @DavidCrediverso. How about using your code to connect to the DQL? It connects to /topic/website.integration.customer only. So, the following error:

User website-int is not authorized to read from: queue://DLQ.website.integration.customer

It has nothing to do with Django STOMP. It's related to the broker you are connecting to.

I have only this information from the service side. When I am testing, it works with stomp. I want to use django-stomp for that.

Can you help me, or what do I need to ask of the team who gave me these parameters?

@DavidCrediverso which broker are you using? Is it ActiveMQ or RabbitMQ?

Did you try to emulate locally using Docker? Django STOMP uses a real RabbitMQ (look at it here in the docker compose file) to guarantee its business rules. We can do the same thing to test yours.

Can you help me, or what do I need to ask of the team who gave me these parameters?

Like I said, it seems the issue is on the broker side. To be totally sure about it, you can emulate locally and understand what is happening. Can you do that?

My company bought a service from another company, and they gave me these parameters for connections. They are using ActiveMQ. I tested how it works by using the stomp library, and I received all the messages, so it's working. I have a project in Django and I want to use this Django-stomp, but using the same parameters, I can't receive messages. I can't run a broker locally. If the issue is on the broker's side, why is the stomp library working? Maybe the problem is with replacing DLQ or with subscriptions. Here is how it works.

@DavidCrediverso did you read the known limitations sections?

If the issue is on the broker's side, why is the stomp library working?

Like I said here, you tested it considering only one destination, but Django STOMP uses two: one main destinations and its DLQ. You didn't test the full cycle.

I can't run a broker locally.

You can use a container engine, so you don't need to install the broker or something.

I'll create a repository with your scenario when I have time. I'll let you know here. By the way, I wrote a blog post about transactions with STOMP. Maybe you can use this project and figure out what is missing in yours.

Closing it as we didn't receive any more inputs.