View Javadoc

1   /*
2    * $Id: SingleJmsMessageReceiver.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.jms;
12  
13  import org.mule.umo.UMOComponent;
14  import org.mule.umo.endpoint.UMOEndpoint;
15  import org.mule.umo.lifecycle.InitialisationException;
16  import org.mule.umo.provider.UMOConnector;
17  
18  import javax.jms.Message;
19  import javax.jms.MessageListener;
20  
21  /**
22   * Registers a single Jms MessageListener for an endpoint
23   */
24  public class SingleJmsMessageReceiver extends JmsMessageReceiver implements MessageListener
25  {
26  
27      public SingleJmsMessageReceiver(UMOConnector connector, UMOComponent component, UMOEndpoint endpoint)
28          throws InitialisationException
29      {
30          super(connector, component, endpoint);
31      }
32  
33  
34      public void onMessage(Message message)
35      {
36          try
37          {
38              JmsWorker worker = new JmsWorker(message, this);
39              worker.run();
40          }
41          catch (Exception e)
42          {
43              handleException(e);
44          }
45      }
46  }