Home  >  Forum  >  Spring
Post New Query

Error: RabbitMQ and Spring - receiveMessage not found


joined on
November 02,2014
Asked on December 20,2014
Hi All,

I am learning Spring and RabbitMQ integration. I have craeted a receiver class, which has a method receiveMessage.

public class Receiver {

private CountDownLatch latch = new CountDownLatch(1);

public void receiveMessage(String message) {
System.out.println(message);
latch.countDown();
}

public CountDownLatch getLatch() {
return latch;
}

}

While running application, got below error, what am I doing wrong.

 Caused by: java.lang.NoSuchMethodException: com.test.rabbitmq.MessageReceiver.receiveMessage(java.lang.String)
at java.lang.Class.getMethod(Class.java:1665) ~[na:1.7.0_45]
at org.springframework.util.MethodInvoker.prepare(MethodInvoker.java:174) ~[spring-core-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:326) ~[spring-rabbit-1.4.0.RELEASE.jar:na]
joined on
July 15,2014
Replied on December 20,2014

      Check  for the below line in your configuration class.

        @Bean
MessageListenerAdapter listenerAdapter(MessageReceiver receiver) {
return new MessageListenerAdapter(receiver, "receiveMessage");
}

Find the link for complete example.

http://www.concretepage.com/spring-4/spring-4-rabbitmq-integration-annotation-example
joined on
November 02,2014
Replied on December 20,2014

Working.
Thanks for the reply.


Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us