i am listening to rabbit queue via spring-queue and I am getting this error:
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Failed to invoke target method 'orchestrate' with argument type = [class [B], value = [{[B@109a1f6c}] at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:408) ~[spring-rabbit-1.5.6.RELEASE.jar!/:na]
Caused by: java.lang.NoSuchMethodException: com.....method([B)
my method accepts List.
@Bean public SimpleRabbitListenerContainerFactory listenerContainer(){
SimpleRabbitListenerContainerFactory factory = new
SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(rabbitConnectionFactory());
factory.setMessageConverter(new Jackson2JsonMessageConverter());
}
@Bean public MessageListenerAdapter newTest() {
return new MessageListenerAdapter(testing, "method");
}
You need to show your
testing.method()
.Also, the
Jackson2JsonMessageConverter
requires the content type header to containjson
, such asapplication/json
.It also needs some type information in headers so it knows what type to convert to; otherwise you'll just get a
Map
.Consider using the
@RabbitListener
annotation instead, and upgrade to a newer version of Spring AMQP (the current version is 1.7.3); the type information for the@RabbitListener
method is conveyed to the converter.