smallrye-reactive-messaging icon indicating copy to clipboard operation
smallrye-reactive-messaging copied to clipboard

smallrye-rabbitmq: Can't publish directly to queue with amq.default (or empty) exchange

Open gbzarelli opened this issue 3 years ago • 1 comments

The rabbitmq allow directly publish using the default exchange (amq.default)

image

I configure my quarkus app with the following values:

mp.messaging.outgoing.sample-queue.connector=smallrye-rabbitmq
mp.messaging.outgoing.sample-queue.default-routing-key=sample-queue
mp.messaging.outgoing.sample-queue.exchange.name=amq.default
mp.messaging.outgoing.sample-queue.exchange.declare=false

Code:

import org.eclipse.microprofile.reactive.messaging.Channel;
import org.eclipse.microprofile.reactive.messaging.Emitter;
...
    @Channel("sample-queue")
    Emitter<OutputMessage> sampleQueue;
...
    sampleQueue.send(message);

But the message was not reached to destine and the output log says:

Log DEBUG:

DEBUG [io.sma.rea.mes.rabbitmq] (vert.x-eventloop-thread-0) SRMSG17022: Sending a message to exchange `amq.default` with routing key sample-queue

If I publish manually using the same arguments the message was reached:

image

Is it possible to send a direct message from this library? I don't have any problem using exchange, just using the direct publication with the amq.default exchange.

I'm using Quarkus version 2.7.3.Final with dependency:

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-reactive-messaging-rabbitmq</artifactId>
    </dependency>

gbzarelli avatar Mar 03 '22 17:03 gbzarelli

With version 3.16 of the plugin, using amq.* as exchange name is forbidden (which is not a problem, as it was not working anyway).

As far as I understand, setting the exchange name to the empty string makes it the default exchange. But quarkus/microprofile config does not allow to set the exchange name (or any property) to the empty string.

@cescoffier Could we specify a special string for the exchange name, such as default-exchange, which would be converted to the empty string before establishing the connection to the exchange via vertx?

My hope is that a small change around this line might do the trick. https://github.com/smallrye/smallrye-reactive-messaging/blob/f92edda52d6e735801eb603823e0dc90c0a643e9/smallrye-reactive-messaging-rabbitmq/src/main/java/io/smallrye/reactive/messaging/rabbitmq/RabbitMQConnector.java#L438

hjklapp avatar Jun 14 '22 12:06 hjklapp

Fixed in #1949

ozangunalp avatar Nov 09 '22 14:11 ozangunalp