Hi

Okay so it looks like there is no support for that mandatory flag. You
are welcome to log a JIRA and work on a github PR
http://camel.apache.org/contributing

On Wed, Sep 27, 2017 at 8:37 PM, Juan Ignacio Barisich
<[email protected]> wrote:
> Hi all
> I am using the ProducerTemplate to send messages through RabbitMQ, with a
> code like:
>
> ProducerTemplate camelProducer = ...;
>> Object body = "a body";
>> Map<String, Object> headers = new HashMap<String, Object>(2);
>> headers.put(RabbitMQConstants.DELIVERY_MODE, "2");
>> camelProducer.*sendBodyAndHeaders*(endpoint, body, headers);
>
>
> That code works ok, but I need some way to set the mandatory flag in true,
> to handle unroutable messages, as is said at
> http://www.rabbitmq.com/api-guide.html#returning
>
> If I put a breakpoint at the basicPublish(*) methods
> of com.rabbitmq.client.impl.ChannelN class, I can see that the camel
> invocation comes from RabbitMQProducer, method basicPublish, line:
>
> channel.basicPublish(exchange, routingKey, properties, body);
>
>
> That line does not specify the mandatory flag, so the RabbitMQ code uses
> false as default:
>
> public void basicPublish(String exchange, String routingKey,
>> BasicProperties props, byte[] body) throws IOException {
>>         basicPublish(exchange, routingKey, *false*, props, body);
>> }
>
>
> Do you know if there is a hack to set the mandatory flag in true, while
> sending a message to RabbitMQ by using the ProducerTemplate ? BTW I am
> using camel 2.15.3
>
> Thanks in advance.
>
> Best regards,
> Juan



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to