Spring Web Services Framework

org.springframework.ws.transport.jms
Class WebServiceMessageDrivenBean

java.lang.Object
  extended by org.springframework.ejb.support.AbstractEnterpriseBean
      extended by org.springframework.ejb.support.AbstractMessageDrivenBean
          extended by org.springframework.ejb.support.AbstractJmsMessageDrivenBean
              extended by org.springframework.ws.transport.jms.WebServiceMessageDrivenBean
All Implemented Interfaces:
Serializable, EnterpriseBean, MessageDrivenBean, MessageListener

public class WebServiceMessageDrivenBean
extends AbstractJmsMessageDrivenBean

EJB MessageDrivenBean that can be used to handleMessage incoming JMS messages.

This class needs a JMS ConnectionFactory, a WebServiceMessageFactory and WebServiceMessageReceiver to operate. By default, these are obtained by doing a bean lookup on the bean factory provided by AbstractEnterpriseBean.getBeanFactory() the super class.

Author:
Arjen Poutsma
See Also:
createConnectionFactory(), createMessageFactory(), createMessageReceiver(), Serialized Form

Field Summary
static String CONNECTION_FACTORY_BEAN_NAME
          Well-known name for the ConnectionFactory object in the bean factory for this bean.
static String MESSAGE_FACTORY_BEAN_NAME
          Well-known name for the WebServiceMessageFactory bean in the bean factory for this bean.
static String MESSAGE_RECEIVER_BEAN_NAME
          Well-known name for the WebServiceMessageReceiver object in the bean factory for this bean.
 
Fields inherited from class org.springframework.ejb.support.AbstractMessageDrivenBean
logger
 
Fields inherited from class org.springframework.ejb.support.AbstractEnterpriseBean
BEAN_FACTORY_PATH_ENVIRONMENT_KEY
 
Constructor Summary
WebServiceMessageDrivenBean()
           
 
Method Summary
protected  Connection createConnection(ConnectionFactory connectionFactory)
          Create a JMS Connection using the given ConnectionFactory.
protected  ConnectionFactory createConnectionFactory()
          Creates a connection factory.
protected  WebServiceMessageFactory createMessageFactory()
          Creates a message factory.
protected  WebServiceMessageReceiver createMessageReceiver()
          Creates a connection factory.
protected  Session createSession(Connection connection)
          Creates a JMS Session.
protected  void onEjbCreate()
          Creates a new Connection, WebServiceMessageFactory, and WebServiceMessageReceiver.
 void onMessage(Message message)
          Delegates to JmsMessageReceiver.handleMessage(Message,Session).
 
Methods inherited from class org.springframework.ejb.support.AbstractMessageDrivenBean
ejbCreate, getMessageDrivenContext, setMessageDrivenContext
 
Methods inherited from class org.springframework.ejb.support.AbstractEnterpriseBean
ejbRemove, getBeanFactory, onEjbRemove, setBeanFactoryLocator, setBeanFactoryLocatorKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ejb.MessageDrivenBean
ejbRemove
 

Field Detail

CONNECTION_FACTORY_BEAN_NAME

public static final String CONNECTION_FACTORY_BEAN_NAME
Well-known name for the ConnectionFactory object in the bean factory for this bean.

See Also:
Constant Field Values

MESSAGE_FACTORY_BEAN_NAME

public static final String MESSAGE_FACTORY_BEAN_NAME
Well-known name for the WebServiceMessageFactory bean in the bean factory for this bean.

See Also:
Constant Field Values

MESSAGE_RECEIVER_BEAN_NAME

public static final String MESSAGE_RECEIVER_BEAN_NAME
Well-known name for the WebServiceMessageReceiver object in the bean factory for this bean.

See Also:
Constant Field Values
Constructor Detail

WebServiceMessageDrivenBean

public WebServiceMessageDrivenBean()
Method Detail

onMessage

public void onMessage(Message message)
Delegates to JmsMessageReceiver.handleMessage(Message,Session).


onEjbCreate

protected void onEjbCreate()
Creates a new Connection, WebServiceMessageFactory, and WebServiceMessageReceiver.

Specified by:
onEjbCreate in class AbstractMessageDrivenBean
See Also:
createConnectionFactory(), createMessageFactory(), createMessageReceiver()

createConnectionFactory

protected ConnectionFactory createConnectionFactory()
                                             throws Exception
Creates a connection factory. Default implemantion does a bean lookup for CONNECTION_FACTORY_BEAN_NAME.

Throws:
Exception

createMessageFactory

protected WebServiceMessageFactory createMessageFactory()
Creates a message factory. Default implemantion does a bean lookup for MESSAGE_FACTORY_BEAN_NAME.


createMessageReceiver

protected WebServiceMessageReceiver createMessageReceiver()
Creates a connection factory. Default implemantion does a bean lookup for MESSAGE_RECEIVER_BEAN_NAME.


createConnection

protected Connection createConnection(ConnectionFactory connectionFactory)
                               throws JMSException
Create a JMS Connection using the given ConnectionFactory.

This implementation uses JMS 1.1 API.

Parameters:
connectionFactory - the JMS ConnectionFactory to create a Connection with
Returns:
the new JMS Connection
Throws:
JMSException - if thrown by JMS API methods
See Also:
ConnectionFactory.createConnection()

createSession

protected Session createSession(Connection connection)
                         throws JMSException
Creates a JMS Session. Default implemantion creates a non-transactional, auto acknowledged session.

This implementation uses JMS 1.1 API.

Parameters:
connection - the JMS Connection to create a Session for
Returns:
the new JMS Session
Throws:
JMSException - if thrown by JMS API methods
See Also:
Connection.createSession(boolean,int)

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.