-
Notifications
You must be signed in to change notification settings - Fork 47
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
AmazonMQ Invalid Target address: amqp+ssl #182
Comments
[UPDATE]
In this way I can send the message, but the recipient queue is wrong: instead of being the queue defined in parsed = compat.urlparse(uri)
plain_auth = uamqp.authentication.SASLPlain(parsed.hostname, key_name, access_key, port=int(port))
try:
msg_props = uamqp.message.MessageProperties()
msg_props.to = "queue://test/"
message = uamqp.Message("content", properties=msg_props)
results = uamqp.send_message(URI, message, auth=plain_auth)
assert not [m for m in results if m == uamqp.constants.MessageState.SendFailed]
print("Message sent!")
except Exception as e:
print("Error " + str(e))
print("Message not sent!") where I assume that msg_props.to = "queue://test/" was the right syntax of the message destination. |
hey @loretoparisi , thanks for reaching out and apologize for the late response. I haven't tried using uamqp to connect to AmazonMQ, will give a try when i have some time. |
@yunhaoling currently the error was
thank you. |
I think the biggest problem is that ActiveMQ (and thus AmazonMQ since it's using ActiveMQ) expects the address of a message to be either In https://github.com/Azure/azure-uamqp-python/blob/473fa5/uamqp/address.py#L35-L45 the address for the message is assumed to be an URL Using logging we can also see that ActiveMQ is communicating this on this line:
Almost complete logs:
(I hope I didn't botch anything with my anonymization attempt) |
Oh, and if I just change https://github.com/Azure/azure-uamqp-python/blob/473fa5/uamqp/address.py#L45 to: self._c_address = c_uamqp.string_value(b"queue://myqueue") it works. |
Used @simmel tip and managed to work this way: import uamqp
from uamqp import c_uamqp
import requests
URI = "amqps+ssl://xxxxxxx.mq.xxxxxx.amazonaws.com/"
parsed = requests.compat.urlparse(URI)
plain_auth = uamqp.authentication.SASLPlain(parsed.hostname, "USERNAME", "PASSWORD",
port=5671, transport_type=uamqp.TransportType.Amqp)
target = uamqp.address.Target(URI)
target._address.address = c_uamqp.string_value(b"queue://myqueue")
results = uamqp.send_message(target, "content", auth=plain_auth)
assert not [m for m in results if m == uamqp.constants.MessageState.SendFailed] |
Oh, that's much less hacky @gustavohwulee ! Thanks for sharing! Really want this fixed upstream though. |
UAMQP Package Version:
uamqp 1.2.12
Operating System:
macOS 10.14.5
Python Version:
python 3.7
Describe the bug
The error when trying to connect and send a message is the following:
I have used the configuration requested
I'm using the example here, the resulting url scheme used is
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: