[rabbitmq-discuss] AMQP.BasicProperties.setMessageId() deprecated

Matthias Radestock matthias at rabbitmq.com
Sat May 5 12:41:07 BST 2012


Matthew,

On 03/05/12 16:38, m.luchak at smartasking.com wrote:
> I am attempting to set the message ID (on a producer) and see that
> AMQP.BasicProperties.setMessageId() is deprecated. I believe that I
> should/could be using builder but the messageID is returning as null.
>
> AMQP.BasicProperties props = new AMQP.BasicProperties();
> props.builder().messageId(" yadada ");
> props.builder().build();
> channel.basicPublish(EXCHANGE_NAME, routingKey, props, message.getBytes());
>
> does not return a messageID

See the example at http://www.rabbitmq.com/api-guide.html for usage of 
the builder classes. You may also want to read up on the builder pattern 
in general. The mistake in the above is that basicPublish is invoked 
with the plain props object constructed in the first line, rather than 
the object produced by the builder.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list