vert-x3 / vertx-amqp-client

An AMQP client for Vert.x
Apache License 2.0
17 stars 18 forks source link

Use with RabbitMq #25

Open adeptmatt opened 4 years ago

adeptmatt commented 4 years ago

Hi guys,

I am in a massive rabbit hole here (pun intended).

I am trying to implemented an anonymous sender and dynamic receiver. My test program works with ActiveMQ but we use Rabbit in production. I went on a wild goose chase to find that you need to enable the amqp1.0 plugin in RabbitMQ - I would suggest possibly documenting this somewhere? It could hopefully save someone a few hours.

After successfully establishing a connection to my RabbitMQ server I noticed that "createAnonymousSender" and "createDynamicReceiver" both seem to suffer from an exception being thrown, they don't call my handler for success / error. I registered an exception handler and found that this gets thrown:

java.lang.Exception: Connection disconnected
    at io.vertx.amqp.impl.AmqpConnectionImpl.onDisconnect(AmqpConnectionImpl.java:135)
    at io.vertx.amqp.impl.AmqpConnectionImpl.lambda$null$2(AmqpConnectionImpl.java:98)
    at io.vertx.proton.impl.ProtonConnectionImpl.lambda$getDefaultSession$6(ProtonConnectionImpl.java:263)
    at io.vertx.proton.impl.ProtonSessionImpl.fireRemoteClose(ProtonSessionImpl.java:276)
    at io.vertx.proton.impl.ProtonTransport.handleSocketBuffer(ProtonTransport.java:130)
    at io.vertx.core.net.impl.NetSocketImpl$DataMessageHandler.handle(NetSocketImpl.java:386)
    at io.vertx.core.net.impl.NetSocketImpl.lambda$new$2(NetSocketImpl.java:101)
    at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:237)
    at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:127)

I managed to dig a little deeper and things started pointing at Rabbit, I looked in the logs and found this:

Closing session for connection <0.671.0>:
{'v1_0.error',{symbol,<<"amqp:invalid-field">>},
              {utf8,<<"Attach rejected: {address_not_utf8_string,undefined}">>},
              undefined}

I've kind of hit a dead-end now though. I am not sure if this is a configuration problem on Rabbit or something in the library?

Let me know if I can provide anything more to assist.

vietj commented 4 years ago

can you provide a reproducer project @adeptmatt ?

adeptmatt commented 4 years ago

Sure,

https://github.com/adeptmatt/vertxamqprabbit

To reproduce:

Ps. The log I referenced earlier is located in /var/log/rabbitmq/

gemmellr commented 4 years ago

I dont believe RabbitMQ supports either basic dynamic sources (required to create a dynamic receiver), or the layered anonymous-relay extension mechanism needed for anonymous producer links, so those calls simply wont work against it in that case.

The error you posted is presumably around the latter, where a link is established with no target address specified in order to signify the anonymous relay node, and in not supporting that the broker then killed the session (rather than just rejecting the link).