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

AMQP 1.0 Shovels: expose additional capabilities needed for successful connection to some AMQP 1.0 brokers #10752

Open
madmalkav opened this issue Mar 15, 2024 · 3 comments

Comments

@madmalkav
Copy link

madmalkav commented Mar 15, 2024

When connecting to some AMQP 1.0 brokers, we cannot set capabilities on the shovel, so in some scenarios we are unable to give the shovel the proper configuration. In example, for IBM MQ , if you want to use a queue but don't set capabilities to queue, it will default to believe the object name provided is for a topic:

imagen

This is documented on IBM website:

imagen

I was able to replicate this same behavior with QPid Proton and this code sample, this code doesn't set capabilities so the same behavior happens:

from __future__ import print_function, unicode_literals
from proton import Message
from proton.handlers import MessagingHandler
from proton.reactor import Container

class HelloWorld(MessagingHandler):
    def __init__(self, server, address):
        super(HelloWorld, self).__init__()
        self.server = server
        self.address = address

    def on_start(self, event):
        print("connecting ...")
        conn = event.container.connect(self.server, sasl_enabled=True, allowed_mechs="PLAIN", allow_insecure_mechs=True, user="app", password="passw0rd")
        event.container.create_sender(conn, self.address)

    def on_sendable(self, event):
        print("sending command")
        event.sender.send(Message(body="Hello World!", address="DEV.QUEUE.2", content_type="text/plain"))
        event.sender.close()
        event.connection.close()

Container(HelloWorld("queue://172.17.0.2:5672", "DEV.QUEUE.2")).run()

This code set capabilities so it works OK:

from __future__ import print_function, unicode_literals
from proton import Message, symbol
from proton.handlers import MessagingHandler
from proton.reactor import Container, SenderOption

class HelloWorld(MessagingHandler):
    def __init__(self, server, address):
        super(HelloWorld, self).__init__()
        self.server = server
        self.address = address

    def on_start(self, event):
        print("connecting ...")
        conn = event.container.connect(self.server, sasl_enabled=True, allowed_mechs="PLAIN", allow_insecure_mechs=True, user="app", password="passw0rd")
        event.container.create_sender(conn, self.address, options=CapabilityOptions())

    def on_sendable(self, event):
        print("sending command")
        event.sender.send(Message(body="Hello World!", address="DEV.QUEUE.2", content_type="text/plain"))
        event.sender.close()
        event.connection.close()

class CapabilityOptions(SenderOption):
    def apply(self, sender):
        sender.target.capabilities.put_object(symbol("queue"))

Container(HelloWorld("amqp://172.17.0.2:5672", "DEV.QUEUE.2")).run()

Describe the solution you'd like

Some way to be able to set those capabilities on the shovel configuration.

Describe alternatives you've considered

No response

Additional context

No response

@ansd
Copy link
Member

ansd commented Mar 15, 2024

Hey @madmalkav, if that's what IBM MQ requires, feel free to create PR to add a capabilities field to the shovel configuration and pass that value through to the AMQP 1.0 Erlang client when it sends the ATTACH frame.

@madmalkav
Copy link
Author

I have no knowledge of coding in general or Erlang in particular (I’m still surprised I got those Python samples to work…), so sending a PR is way above my skillset 😅

@michaelklishin
Copy link
Member

Thank you for providing enough details and executable versions. It's a fair feature to request, we certainly would like to have a more complete Shovel support for IBM MQ targets. However, we cannot promise any particular ETA date.

@michaelklishin michaelklishin changed the title Shovel and AMQP 1.0 targets: expose capabilities needed for some brokers AMQP 1.0 Shovels: expose additional capabilities needed for successful connection to some AMQP 1.0 brokers Mar 15, 2024
@lukebakken lukebakken self-assigned this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants