You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Arnaud Chotard (Jira)" <ji...@apache.org> on 2020/01/15 15:38:00 UTC

[jira] [Updated] (CAMEL-14407) Add a consumerTag on the RabbitMQ camel endpoint

     [ https://issues.apache.org/jira/browse/CAMEL-14407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arnaud Chotard updated CAMEL-14407:
-----------------------------------
    Description: 
What do you think about adding a consumerTag to the Camel RabbitMQ endpoint ?

The consumerTag allows you to specify a client-generated consumer tag to establish context when invoking channel.basicConsume() :
{code:java}
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOException;{code}
The evolution to realize is simple.

1/ Add the consumerTag in the RabbitMQEndpoint class:
{code:java}
@UriParam (label = "consumer")
private String consumerTag = "";{code}
2/ Use the consumerTag in the RabbitConsumer class:
{code:java}
@Override
protected void doStart () throws Exception {
   if (channel == null) {
      throw new IOException ("The RabbitMQ channel is not open");
   }
   tag = channel.basicConsume (consumer.getEndpoint(). getQueue(), consumer.getEndpoint().isAutoAck(), consumer.getEndpoint().getConsumerTag(), false, consumer.getEndpoint().isExclusiveConsumer(), null, this);
 }{code}
NB : This functionnality exists on Spring AMQP through the org.springframework.amqp.support.ConsumerTagStrategy interface.

  was:
What do you think about adding a consumerTag to the Camel RabbitMQ endpoint ?

The consumerTag allows you to specify a client-generated consumer tag to establish context when invoking channel.basicConsume() :
{code:java}
String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOException;{code}
The evolution to realize is simple.

1/ Add the field in the RabbitMQEndpoint class:
{code:java}
@UriParam (label = "consumer")
private String consumerTag = "";{code}
2/ Use the consumerTag in the RabbitConsumer class:
{code:java}
@Override
protected void doStart () throws Exception {
   if (channel == null) {
      throw new IOException ("The RabbitMQ channel is not open");
   }
   tag = channel.basicConsume (consumer.getEndpoint(). getQueue(), consumer.getEndpoint().isAutoAck(), consumer.getEndpoint().getConsumerTag(), false, consumer.getEndpoint().isExclusiveConsumer(), null, this);
 }{code}
NB : This functionnality exists on Spring AMQP through the org.springframework.amqp.support.ConsumerTagStrategy interface.


> Add a consumerTag on the RabbitMQ camel endpoint
> ------------------------------------------------
>
>                 Key: CAMEL-14407
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14407
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-rabbitmq
>    Affects Versions: 2.24.2
>            Reporter: Arnaud Chotard
>            Priority: Major
>
> What do you think about adding a consumerTag to the Camel RabbitMQ endpoint ?
> The consumerTag allows you to specify a client-generated consumer tag to establish context when invoking channel.basicConsume() :
> {code:java}
> String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOException;{code}
> The evolution to realize is simple.
> 1/ Add the consumerTag in the RabbitMQEndpoint class:
> {code:java}
> @UriParam (label = "consumer")
> private String consumerTag = "";{code}
> 2/ Use the consumerTag in the RabbitConsumer class:
> {code:java}
> @Override
> protected void doStart () throws Exception {
>    if (channel == null) {
>       throw new IOException ("The RabbitMQ channel is not open");
>    }
>    tag = channel.basicConsume (consumer.getEndpoint(). getQueue(), consumer.getEndpoint().isAutoAck(), consumer.getEndpoint().getConsumerTag(), false, consumer.getEndpoint().isExclusiveConsumer(), null, this);
>  }{code}
> NB : This functionnality exists on Spring AMQP through the org.springframework.amqp.support.ConsumerTagStrategy interface.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)