Hi,
again it's me. I have a question regarding the implementation of this scenario: http://rdoc.info/github/ruby-amqp/am..._Reply_pattern
My producer looks like this:
Now the question is, how to implement the opposite on the consumer side:Code:rabbitTemplate.convertAndSend(EXCHANGE_NAME, ROUTING_KEY_NAME, job, new MessagePostProcessor() { @Override public Message postProcessMessage(Message message) throws AmqpException { message.getMessageProperties().setReplyTo(RESPONSE_QUEUE); try { message.getMessageProperties().setCorrelationId(UUID.randomUUID().toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { throw new AmqpException(ex); } return message; } });
In the documentation I couldn't find anything regarding that... Do I need to that via rabbitTemplate?Code:/* (non-Javadoc) * @see org.springframework.amqp.rabbit.core.ChannelAwareMessageListener#onMessage(org.springframework.amqp.core.Message, com.rabbitmq.client.Channel) */ @Override public void onMessage(Message message, Channel channel) throws Exception { Job job = listenerHelper.convertMessage(message); Thread.sleep(2000); System.out.println("received: " + job.getCommand()); channel.basicAck(message.getMessageProperties().getDeliveryTag(), true); }


Reply With Quote
