Results 1 to 3 of 3

Thread: To call Default Message Listener

  1. #1

    Default To call Default Message Listener

    Hi Folks,

    I plugged in my Message Listener as below:

    <!-- and this is the message listener container -->
    <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory"/>
    <property name="destination" ref="destination"/>
    <property name="messageListener" ref="messageListener" />
    </bean>

    <!-- this is the Message Driven POJO (MDP) -->
    <bean id="messageListener" class="nj.lwd.jms.listener.ExampleListener" />

    And i declared my onMessage method in my "ExampleListener" and here is the code for it:

    public class ExampleListener implements MessageListener {

    public void onMessage(Message message) {
    if (message instanceof TextMessage) {
    try {
    System.out.println(((TextMessage) message).getText());
    }
    catch (JMSException ex) {
    throw new RuntimeException(ex);
    }
    }
    else {
    throw new IllegalArgumentException("Message must be of type TextMessage");
    }
    }
    }

    Can any one help me how the "onMessage" method will be called when there is some message in my Queue.

    Are there any additional plug-ins need to by done to call this asynchronously.

    Thanks in Advance,
    N.Naveen.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Please use [ code][/code ] tags when posting code that way it remains readable.

    What you posted should be all you need.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default To call Default Message Listener

    Hi Folks,

    Can i know how that <bean id="jmsContainer"> pointing to [class="org.springframework.jms.listener.DefaultMes sageListenerContainer"] will be called.

    Thanks And Regards,
    N.Naveen.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •