[rabbitmq-discuss] I think the Java tutorial has an error

Simon MacMullen simon at rabbitmq.com
Tue Oct 22 09:40:02 BST 2013


On 21/10/2013 21:21, Kevin Meek wrote:
> The first Java tutorial has
>
>      String  message  =  "Hello World!";
>      channel.basicPublish("",  QUEUE_NAME,  null,  message.getBytes());
>
> where I believe the first parameter should be the message String itself.  No?

No. The first parameter is the name of the exchange to publish to - in 
this case "" means the default exchange, which always routes to the 
named queue. See 
http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.1.5/rabbitmq-java-client-javadoc-3.1.5/com/rabbitmq/client/Channel.html#basicPublish(java.lang.String, 
java.lang.String, com.rabbitmq.client.AMQP.BasicProperties, byte[])

Cheers, Simon


More information about the rabbitmq-discuss mailing list