Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jms.listener.serversession
Class ServerSessionMessageListenerContainer

    java.lang.Object
      org.springframework.jms.support.JmsAccessor
          org.springframework.jms.support.destination.JmsDestinationAccessor
              org.springframework.jms.listener.AbstractJmsListeningContainer
                  org.springframework.jms.listener.AbstractMessageListenerContainer
                      org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer

All Implemented Interfaces:
  BeanNameAware, DisposableBean, InitializingBean, Lifecycle, ListenerSessionManager

Direct Known Subclasses:
  ServerSessionMessageListenerContainer102

Deprecated. as of Spring 2.5, in favor of DefaultMessageListenerContainer and JmsMessageEndpointManager. To be removed in Spring 3.0.

    public class ServerSessionMessageListenerContainer

extends AbstractMessageListenerContainer
implements ListenerSessionManager

Message listener container that builds on the `ServerSessionPool` SPI, creating JMS ServerSession instances through a pluggable `ServerSessionFactory`.

NOTE: This class requires a JMS 1.1+ provider, because it builds on the domain-independent API. Use the `ServerSessionMessageListenerContainer102` subclass for a JMS 1.0.2 provider, e.g. when running on a J2EE 1.3 server.

The default ServerSessionFactory is a `SimpleServerSessionFactory`, which will create a new ServerSession for each listener execution. Consider specifying a `CommonsPoolServerSessionFactory` to reuse JMS Sessions and/or to limit the number of concurrent ServerSession executions.

See the `AbstractMessageListenerContainer` javadoc for details on acknowledge modes and other configuration options.

This is an 'advanced' (special-purpose) message listener container. For a simpler message listener container, in particular when using a JMS provider without ServerSessionPool support, consider using `SimpleMessageListenerContainer`. For a general one-stop shop that is nevertheless very flexible, consider `DefaultMessageListenerContainer`.

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  `SimpleMessageListenerContainer`, `JmsMessageEndpointManager`

Nested Class Summary

Nested classes/interfaces inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
`AbstractJmsListeningContainer.SharedConnectionNotInitializedException`

Field Summary

Fields inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
`lifecycleMonitor, sharedConnectionMonitor`

Fields inherited from class org.springframework.jms.support.JmsAccessor
`logger`

Constructor Summary
`ServerSessionMessageListenerContainer()` Deprecated.

Method Summary
`protected ConnectionConsumer` | `createConsumer(Connection con, Destination destination, ServerSessionPool pool)` Deprecated. Create a JMS ConnectionConsumer for the given Connection.
`Session` | `createListenerSession()` Deprecated. Create a JMS Session with the specified listener registered.
`protected ServerSessionPool` | `createServerSessionPool()` Deprecated. Create a JMS ServerSessionPool for the specified message listener, via this container's ServerSessionFactory.
`protected void` | `doInitialize()` Deprecated. Creates a JMS ServerSessionPool for the specified listener and registers it with a JMS ConnectionConsumer for the specified destination.
`protected void` | `doShutdown()` Deprecated. Close the JMS ServerSessionPool for the specified message listener, via this container's ServerSessionFactory, and subsequently also this container's JMS ConnectionConsumer.
`void` | `executeListenerSession(Session session)` Deprecated. Execute the given JMS Session, triggering invocation of its listener.
`protected ConnectionConsumer` | `getConsumer()` Deprecated. Return the JMS ConnectionConsumer used by this message listener container.
`protected int` | `getMaxMessagesPerTask()` Deprecated. Return the maximum number of messages to load into a JMS Session.
`protected ServerSessionFactory` | `getServerSessionFactory()` Deprecated. Return the Spring ServerSessionFactory to use.
`void` | `setMaxMessagesPerTask(int maxMessagesPerTask)` Deprecated. Set the maximum number of messages to load into a JMS Session.
`void` | `setServerSessionFactory(ServerSessionFactory serverSessionFactory)` Deprecated. Set the Spring ServerSessionFactory to use.
`protected boolean` | `sharedConnectionEnabled()` Deprecated. Always use a shared JMS Connection.

Methods inherited from class org.springframework.jms.listener.AbstractMessageListenerContainer
`checkMessageListener, commitIfNecessary, doExecuteListener, doInvokeListener, doInvokeListener, executeListener, getDefaultSubscriptionName, getDestination, getDestinationDescription, getDestinationName, getDurableSubscriptionName, getExceptionListener, getMessageListener, getMessageSelector, handleListenerException, invokeExceptionListener, invokeListener, isAcceptMessagesWhileStopping, isExposeListenerSession, isSessionLocallyTransacted, isSubscriptionDurable, rollbackIfNecessary, rollbackOnExceptionIfNecessary, setAcceptMessagesWhileStopping, setDestination, setDestinationName, setDurableSubscriptionName, setExceptionListener, setExposeListenerSession, setMessageListener, setMessageSelector, setSubscriptionDurable, validateConfiguration`

Methods inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
`afterPropertiesSet, createSharedConnection, destroy, doRescheduleTask, doStart, doStop, establishSharedConnection, getBeanName, getClientId, getPausedTaskCount, getSharedConnection, initialize, isActive, isRunning, logRejectedTask, prepareSharedConnection, refreshSharedConnection, rescheduleTaskIfNecessary, resumePausedTasks, runningAllowed, setAutoStartup, setBeanName, setClientId, shutdown, start, startSharedConnection, stop, stopSharedConnection`

Methods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
`getDestinationResolver, isPubSubDomain, resolveDestinationName, setDestinationResolver, setPubSubDomain`

Methods inherited from class org.springframework.jms.support.JmsAccessor
`convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ServerSessionMessageListenerContainer

    public ServerSessionMessageListenerContainer()

  Deprecated.

Method Detail

### setServerSessionFactory

    public void setServerSessionFactory(ServerSessionFactory serverSessionFactory)

  Deprecated.
  Set the Spring ServerSessionFactory to use.

  Default is a plain SimpleServerSessionFactory. Consider using a CommonsPoolServerSessionFactory to reuse JMS Sessions and/or to limit the number of concurrent ServerSession executions.

  See Also:
    `SimpleServerSessionFactory`, `CommonsPoolServerSessionFactory`

### getServerSessionFactory

    protected ServerSessionFactory getServerSessionFactory()

  Deprecated.
  Return the Spring ServerSessionFactory to use.

### setMaxMessagesPerTask

    public void setMaxMessagesPerTask(int maxMessagesPerTask)

  Deprecated.
  Set the maximum number of messages to load into a JMS Session. Default is 1.

  See the corresponding JMS `createConnectionConsumer` argument for details.

  See Also:
    `Connection.createConnectionConsumer(javax.jms.Destination, java.lang.String, javax.jms.ServerSessionPool, int)`

### getMaxMessagesPerTask

    protected int getMaxMessagesPerTask()

  Deprecated.
  Return the maximum number of messages to load into a JMS Session.

### sharedConnectionEnabled

    protected final boolean sharedConnectionEnabled()

  Deprecated.
  Always use a shared JMS Connection.

  Specified by:
    `sharedConnectionEnabled` in class `AbstractJmsListeningContainer`
  See Also:
    `AbstractJmsListeningContainer.getSharedConnection()`

### doInitialize

    protected void doInitialize()
                         throws JMSException

  Deprecated.
  Creates a JMS ServerSessionPool for the specified listener and registers it with a JMS ConnectionConsumer for the specified destination.

  Specified by:
    `doInitialize` in class `AbstractJmsListeningContainer`
  Throws:
    `JMSException` - if registration failed
  See Also:
    `createServerSessionPool()`, `createConsumer(javax.jms.Connection, javax.jms.Destination, javax.jms.ServerSessionPool)`

### createServerSessionPool

    protected ServerSessionPool createServerSessionPool()
                                                 throws JMSException

  Deprecated.
  Create a JMS ServerSessionPool for the specified message listener, via this container's ServerSessionFactory.

  This message listener container implements the ListenerSessionManager interface, hence can be passed to the ServerSessionFactory itself.

  Returns:
    the ServerSessionPool
  Throws:
    `JMSException` - if creation of the ServerSessionPool failed
  See Also:
    `setServerSessionFactory(org.springframework.jms.listener.serversession.ServerSessionFactory)`, `ServerSessionFactory.getServerSession(ListenerSessionManager)`

### getConsumer

    protected final ConnectionConsumer getConsumer()

  Deprecated.
  Return the JMS ConnectionConsumer used by this message listener container. Available after initialization.

### doShutdown

    protected void doShutdown()
                       throws JMSException

  Deprecated.
  Close the JMS ServerSessionPool for the specified message listener, via this container's ServerSessionFactory, and subsequently also this container's JMS ConnectionConsumer.

  This message listener container implements the ListenerSessionManager interface, hence can be passed to the ServerSessionFactory itself.

  Specified by:
    `doShutdown` in class `AbstractJmsListeningContainer`
  Throws:
    `JMSException` - if shutdown failed
  See Also:
    `setServerSessionFactory(org.springframework.jms.listener.serversession.ServerSessionFactory)`, `ServerSessionFactory.getServerSession(ListenerSessionManager)`

### createListenerSession

    public Session createListenerSession()
                                  throws JMSException

  Deprecated.
  Create a JMS Session with the specified listener registered. Listener execution is delegated to the `executeListener` method.

  Default implementation simply calls `setMessageListener` on a newly created JMS Session, according to the JMS specification's ServerSessionPool section.

  Specified by:
    `createListenerSession` in interface `ListenerSessionManager`
  Returns:
    the JMS Session
  Throws:
    `JMSException` - if thrown by JMS API methods
  See Also:
    `AbstractMessageListenerContainer.executeListener(javax.jms.Session, javax.jms.Message)`

### executeListenerSession

    public void executeListenerSession(Session session)

  Deprecated.
  Execute the given JMS Session, triggering invocation of its listener.

  Default implementation simply calls `run()` on the JMS Session, according to the JMS specification's ServerSessionPool section.

  Specified by:
    `executeListenerSession` in interface `ListenerSessionManager`
  Parameters:
    `session` - the JMS Session to execute
  See Also:
    `Session.run()`

### createConsumer

    protected ConnectionConsumer createConsumer(Connection con,
                                                Destination destination,
                                                ServerSessionPool pool)
                                         throws JMSException

  Deprecated.
  Create a JMS ConnectionConsumer for the given Connection.

  This implementation uses JMS 1.1 API.

  Parameters:
    `con` - the JMS Connection to create a Session for
    `destination` - the JMS Destination to listen to
    `pool` - the ServerSessionpool to use
  Returns:
    the new JMS Session
  Throws:
    `JMSException` - if thrown by JMS API methods

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.