Git Product home page Git Product logo

Comments (7)

hbsis-fernandomedeiros avatar hbsis-fernandomedeiros commented on June 12, 2024 1

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.

from azure-uamqp-python.

annatisch avatar annatisch commented on June 12, 2024

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.

from azure-uamqp-python.

hbsis-fernandomedeiros avatar hbsis-fernandomedeiros commented on June 12, 2024

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()

from azure-uamqp-python.

annatisch avatar annatisch commented on June 12, 2024

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)

from azure-uamqp-python.

annatisch avatar annatisch commented on June 12, 2024

Thanks for the update! Will take a look :)

from azure-uamqp-python.

hbsis-fernandomedeiros avatar hbsis-fernandomedeiros commented on June 12, 2024

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!

from azure-uamqp-python.

leonardomira-zz avatar leonardomira-zz commented on June 12, 2024

@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

from azure-uamqp-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.