List of usage examples for com.rabbitmq.client Channel basicPublish
void basicPublish(String exchange, String routingKey, boolean mandatory, BasicProperties props, byte[] body) throws IOException;
From source file:org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.java
License:Apache License
/** * Send the given response message to the given destination. * @param channel the Rabbit channel to operate on * @param replyTo the Rabbit ReplyTo string to use when sending. Currently interpreted to be the routing key. * @param message the Rabbit message to send * @throws Exception if thrown by Rabbit API methods * @see #postProcessResponse(Message, Message) *//* w w w .j a va2 s .co m*/ protected void sendResponse(Channel channel, Address replyTo, Message message) throws Exception { postProcessChannel(channel, message); try { logger.debug("Publishing response to exchanage = [" + replyTo.getExchangeName() + "], routingKey = [" + replyTo.getRoutingKey() + "]"); channel.basicPublish(replyTo.getExchangeName(), replyTo.getRoutingKey(), this.mandatoryPublish, this.messagePropertiesConverter.fromMessageProperties(message.getMessageProperties(), encoding), message.getBody()); } catch (Exception ex) { throw RabbitExceptionTranslator.convertRabbitAccessException(ex); } }