Announcement Announcement Module
Collapse
No announcement yet.
Unable to reply to JMS message with no messageConverter. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to reply to JMS message with no messageConverter.

    Spring 3.0.6.RELEASE, HornetQ 2.2.2.Final

    According to the Spring documentation, using this config:

    Code:
       <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer"
              p:destinationName="destinationQueueName"
              p:transactionManager-ref="jmsTransactionManager"
              p:connectionFactory-ref="jmsConnectionFactory"
              p:concurrentConsumers="2" >
          <property name="messageListener">
             <bean class="org.springframework.jms.listener.adapter.MessageListenerAdapter"
                 p:defaultListenerMethod="onMessage"
                 p:delegate="com.acme.MyMDP">
                <property name="messageConverter"><null/></property>
             </bean>
          </property>
       </bean>
    and this interface (MyMDP implements it):

    Code:
    public interface ResponsiveTextMessageDelegate {
       String onMessage(TextMessage message);
    }
    I should be able to listen to a TextMessage on this queue, and send/return a TextMessage response to the Reply-To destination (provided by the JMS message sent) if it returns a String as specified, but I get the exception below. If I change the interface and corresponding implementation of my listener class to be just Strings like this, it works:

    Code:
    public interface ResponsiveTextMessageDelegate {
       String onMessage(String message);
    }
    but I really want the former option to work because I want to capture the JMSTimestamp that comes with the TextMessage.
    Anybody know what's wrong? Could it be that this is not supported for hornetq?

    This is the exception trace:
    Code:
    org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Failed to invoke target method 'onMessage' with arguments {HornetQMessage[ID:460b6bf6-0494-11e1-ae8e-1c6f65d5f798]:PERSISTENT}; nested exception is java.lang.NoSuchMethodException: java.lang.String.onMessage(org.hornetq.jms.client.HornetQTextMessage)
    	at org.springframework.jms.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:476)
    	at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:355)
    	at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
    	at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
    	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.NoSuchMethodException: java.lang.String.onMessage(org.hornetq.jms.client.HornetQTextMessage)
    	at java.lang.Class.getMethod(Class.java:1605)
    	at org.springframework.util.MethodInvoker.prepare(MethodInvoker.java:178)
    	at org.springframework.jms.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:462)
Working...
X