Sorry for being vague. I'm using the AmqpOutputboundEndpoint sandbox code to send the message and it works fine using a JRuby consumer. Now I'm working on writing a Java consumer using Spring AMQP. Here's my configuration:
Code:
@Configuration
public class ConsumerConfiguration extends AbstractRabbitConfiguration {
protected static final String QUEUE_NAME = "dbcm-ply-key";
@Bean
public SimpleMessageListenerContainer listenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setQueueName(QUEUE_NAME);
container.setMessageListener(new MessageListenerAdapter(new PolyCalcHandler()));
return container;
}
@Bean
public ConnectionFactory connectionFactory() {
SingleConnectionFactory connectionFactory = new SingleConnectionFactory("localhost");
connectionFactory.setUsername("guest");
connectionFactory.setPassword("guest");
return connectionFactory;
}
@Override
public RabbitTemplate rabbitTemplate() {
RabbitTemplate template = new RabbitTemplate(connectionFactory());
template.setMessageConverter(getJsonMessageConverter());
template.setExchange("dbcm-ex");
template.setRoutingKey(QUEUE_NAME);
template.setQueue(QUEUE_NAME);
return template;
}
@Bean
public Queue dbcmPlyQueue() {
return new Queue(QUEUE_NAME);
}
public MessageConverter getJsonMessageConverter() {
return new JsonMessageConverter();
}
}
----
Here's the PolyCalcHandler:
Code:
public class PolyCalcHandler {
public void handleMessage(PolyCalcRequest request) {
System.out.println(request);
// return null;
}
}
If I specify the above argument for handleMessage, it blows up with the exception. If I specify Object as the arg it hits the method without exception but the message arrives as a byte[]. Am I missing something from the configuration?
Thanks