Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple_send to a different port #85

Open
alexroat opened this issue Jul 25, 2019 · 0 comments
Open

simple_send to a different port #85

alexroat opened this issue Jul 25, 2019 · 0 comments

Comments

@alexroat
Copy link

I'm trying to connect to an ActiveMQ broker which is running on the port 5673 instead of the standard 5671(because on 5671 we are running AMQP 0.91 with another broker).
I used the example:


import os
try:
    from urlparse import urlparse
except ImportError:
    from urllib.parse import urlparse

import uamqp
from uamqp import authentication

uri = "amqp://111.222.333.444:5673/examples/"
key_name = "user"
access_key = ******

def uamqp_send_simple():
    msg_content = b"Hello world"

    parsed_uri = urlparse(uri)
    plain_auth = authentication.SASLPlain(parsed_uri.hostname, key_name, access_key)

    uamqp.send_message(uri, msg_content, auth=plain_auth)
    print("Message sent!")

if __name__ == "__main__":
    uamqp_send_simple()

Anyway, it appears to be not working:

Traceback (most recent call last):
  File "test.py", line 30, in <module>
    uamqp_send_simple()
  File "test.py", line 26, in uamqp_send_simple
    uamqp.send_message(uri, msg_content, auth=plain_auth)
  File "/usr/local/lib/python2.7/dist-packages/uamqp/__init__.py", line 68, in send_message
    return send_client.send_all_messages()
  File "/usr/local/lib/python2.7/dist-packages/uamqp/client.py", line 775, in send_all_messages
    running = self.wait()
  File "/usr/local/lib/python2.7/dist-packages/uamqp/client.py", line 757, in wait
    running = self.do_work()
  File "/usr/local/lib/python2.7/dist-packages/uamqp/client.py", line 401, in do_work
    if not self.client_ready():
  File "/usr/local/lib/python2.7/dist-packages/uamqp/client.py", line 385, in client_ready
    if not self._client_ready():
  File "/usr/local/lib/python2.7/dist-packages/uamqp/client.py", line 531, in _client_ready
    self.message_handler.open()
  File "/usr/local/lib/python2.7/dist-packages/uamqp/sender.py", line 208, in open
    "Failed to open Message Sender. "
uamqp.errors.AMQPConnectionError: Failed to open Message Sender. Please confirm credentials and target URI.

Using wireshark I see that the TCP traffic is still going to 5671, so i suppose the port parameter is ignored at all.

Could you kindly post a working example on how to use uamqp on different TCP port.
The provided examples also they use environment variables, could be helpful to have a sample value of these environmental variables, i suppose is a standard form "amqps://host:port/channel".

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant