Open hbsis-fernandomedeiros opened 5 years ago
Hi @hbsis-fernandomedeiros - sorry for the delay in getting back to you! It looks like the Connection is not even getting to the point of sending the AMQP header.
Could I possibly see a code snippet? This would only need to show how you are initializing the authentication and the client, what kind of auth/endpoint settings you're using etc (please make sure to remove any sensitive info - but it would still be good to see the formatting of the info, for example for an endpoint URL, something like amqps://[servicename].[servicesuffix]/[entityname]
).
I suspect the root cause of this issue is the same as that for issue #44 that I still haven't had a chance to dig into.
Hi there @annatisch how have you been?
I should have been clearer in my post, sorry about that. Here are the steps to reproduce:
I'm running Docker version 18.09.0 on Windows 10 Pro.
1) On my local Docker, run an instance of the following docker image: https://hub.docker.com/r/solace/solace-pubsub-standard/ - remember to use -p 5672:5672 to bind and expose the AMQP port. More info on running Solace on containers: https://docs.solace.com/Solace-SW-Broker-Set-Up/Docker-Containers/Set-Up-Single-Win-Container.htm
2) I've set up a topic named topic-test-01
3) Run this snippet
import os
import logging
logging.basicConfig(level=logging.DEBUG)
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import uamqp
from uamqp import authentication
uri = 'amqp://localhost:5672/topic-test-01'
key_name = 'admin'
access_key = 'admin'
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, debug=True)
print("Message sent!")
if __name__ == "__main__":
uamqp_send_simple()
Perfect! Thanks @hbsis-fernandomedeiros so much for these repro steps. I will take a shot at this over the weekend. As for me - super busy as per usual. Thanks for asking! ;)
One thing that does occur to me - you could try passing in the port that you're using into the auth config:
plain_auth = authentication.SASLPlain(parsed_uri.hostname, key_name, access_key, port=parsed_uri.port)
Just tried that a couple combinations:
#plain_auth = authentication.SASLPlain(parsed_uri.hostname, key_name, access_key, port=parsed_uri.port)
#plain_auth = authentication.SASLPlain('localhost:5672', key_name, access_key, port=parsed_uri.port)
plain_auth = authentication.SASLPlain('localhost:5672', key_name, access_key)
#plain_auth = authentication.SASLPlain(parsed_uri.hostname, key_name, access_key)
Same messages for all of them.
Thanks for the update! Will take a look :)
Hey @annatisch , how have you been? :) Do you have any news on this issue? I tried updating my pip package, but it hadn't any releases for a while... Thanks!
@annatisch and @hbsis-fernandomedeiros We managed to connect on Solace (at least the connection is displayed on Solace dashboard), but we are unable to publish or consume messages. On Solace it is always displayed an "Queue not found" error on the established connection.
With this, we are considering that the problem is related to the amqp connection string, that is wrong or missing some information.
Our example:
def uamqp_send_simple():
uri = "amqps://<user>.messaging.solace.cloud/<solace_vpn>/queue_name/"
port = os.environ.get("AMQP_PORT")
key_name = os.environ.get("AMQP_USERNAME")
access_key = os.environ.get("AMQP_PASSWORD")
parsed_uri = urlparse(uri)
plain_auth = authentication.SASLPlain(parsed_uri.hostname, key_name, access_key, port=port)
t = uamqp.Target(uri)
send_client = uamqp.SendClient(t, auth=plain_auth, debug=True, client_name="send_example_uamqp")
try:
message = uamqp.Message("content")
send_client.queue_message(message)
results = send_client.send_all_messages(close_on_done=False)
assert not [m for m in results if m == uamqp.constants.MessageState.SendFailed]
finally:
send_client.close()
print("Message sent!")
Log:
2019-09-18 11:19:11,145 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.START: 0> to <ConnectionState.START: 0>
2019-09-18 11:19:11,145 uamqp.sender INFO Message sender b'sender-link-886d06d0-3dff-48ef-b567-6874093d296d' state changed from <MessageSenderState.Idle: 0> to <MessageSenderState.Opening: 1> on connection: b'send_example_uamqp'
2019-09-18 11:19:11,296 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.START: 0> to <ConnectionState.START: 0>
2019-09-18 11:19:11,881 uamqp.c_uamqp INFO b'-> Header (AMQP 0.1.0.0)'
2019-09-18 11:19:11,881 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.START: 0> to <ConnectionState.HDR_SENT: 2>
2019-09-18 11:19:11,881 uamqp.c_uamqp INFO b'<- Header (AMQP 0.1.0.0)'
2019-09-18 11:19:11,881 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.HDR_SENT: 2> to <ConnectionState.HDR_EXCH: 3>
2019-09-18 11:19:11,881 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.HDR_EXCH: 3> to <ConnectionState.OPEN_SENT: 7>
2019-09-18 11:19:12,209 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.OPEN_SENT: 7> to <ConnectionState.OPENED: 9>
2019-09-18 11:19:12,499 uamqp.sender INFO Message sender b'sender-link-886d06d0-3dff-48ef-b567-6874093d296d' state changed from <MessageSenderState.Opening: 1> to <MessageSenderState.Open: 2> on connection: b'send_example_uamqp'
2019-09-18 11:19:12,645 uamqp.client INFO Message error, not retrying. Error: MessageSendFailed('ErrorCodes.NotAllowed: SMF AD ack response error')
2019-09-18 11:19:12,645 uamqp.sender INFO Message sender b'sender-link-886d06d0-3dff-48ef-b567-6874093d296d' state changed from <MessageSenderState.Open: 2> to <MessageSenderState.Closing: 3> on connection: b'send_example_uamqp'
2019-09-18 11:19:12,645 uamqp.connection INFO Shutting down connection b'send_example_uamqp'.
2019-09-18 11:19:12,645 uamqp.connection INFO Connection b'send_example_uamqp' state changed from <ConnectionState.OPENED: 9> to <ConnectionState.END: 13>
2019-09-18 11:19:12,645 uamqp.connection INFO Connection shutdown complete b'send_example_uamqp'
EDIT: typos
Hi there,
I've been trying to use uAMQP for Python with a Solace Standard broker running in a local container - Nothing too complex, just the samples provided in this repository. No success so far, although I have a topic and queue set up. I rose the logging level to DEBUG, and it seems to be some issue related to DETACH frame in link protocol - but I'm out of ideas... any idea what could it possibly be? It would be much appreciated :)
Here's the log: