0

When consuming messages using the plugin, you can access the raw Message and its headers/properties.

When sending messages using the rabbitSend method, it appears from the documentation (http://grails-plugins.github.com/grails-rabbitmq/docs/manual/ref/All%20Classes/rabbitSend.html) that you can only set the exchange name, routing key and message body.

How can these headers/properties be set when sending a message using the rabbitSend method?

AndrewW
  • 678
  • 6
  • 18

1 Answers1

0

At present, it looks like you need to use the underlying rabbitTemplate.convertAndSend() method. The link to the RabbitTemplate Javadoc in the plugin's documentation is broken at the moment, it should point to http://static.springsource.org/spring-amqp/api/org/springframework/amqp/rabbit/core/RabbitTemplate.html

I found an example of setting the message properties using the rabbitTemplate.convertAndSend() method on the Grails JIRA http://jira.grails.org/browse/GPRABBITMQ-7

rabbitTemplate.convertAndSend "amq.direct", "work", payload, ({ Message msg ->
    msg.messageProperties.replyTo = new Address("work.reply")
    return msg
} as MessagePostProcessor)
AndrewW
  • 678
  • 6
  • 18