C# Class Spring.Messaging.Nms.Listener.AbstractMessageListenerContainer

Abstract base class for message listener containers. Can either host a standard NMS MessageListener or a Spring-specific ISessionAwareMessageListener
Inheritance: Spring.Messaging.Nms.Listener.AbstractListenerContainer
Datei anzeigen Open project: spring-projects/spring-net Class Usage Examples

Public Methods

Method Description
ExecuteListener ( ISession session, IMessage message ) : void

Executes the specified listener, committing or rolling back the transaction afterwards (if necessary).

Protected Methods

Method Description
CheckMessageListener ( object messageListener ) : void

Checks the message listener, throwing an exception if it does not correspond to a supported listener type. By default, only a standard JMS MessageListener object or a Spring ISessionAwareMessageListener object will be accepted.

CommitIfNecessary ( ISession session, IMessage message ) : void

Perform a commit or message acknowledgement, as appropriate

DoExecuteListener ( ISession session, IMessage message ) : void

Executes the specified listener, committing or rolling back the transaction afterwards (if necessary).

DoInvokeListener ( IMessageListener listener, IMessage message ) : void

Invoke the specified listener as standard JMS MessageListener.

Default implementation performs a plain invocation of the OnMessage methods

DoInvokeListener ( ISessionAwareMessageListener listener, ISession session, IMessage message ) : void

Invoke the specified listener as Spring SessionAwareMessageListener, exposing a new NMS Session (potentially with its own transaction) to the listener if demanded.

HandleListenerException ( Exception ex ) : void

Handle the given exception that arose during listener execution.

The default implementation logs the exception at error level, not propagating it to the JMS provider - assuming that all handling of acknowledgement and/or transactions is done by this listener container. This can be overridden in subclasses.

InvokeErrorHandler ( Exception exception ) : void

Invokes the error handler.

InvokeExceptionListener ( Exception ex ) : void

Invokes the registered exception listener, if any.

InvokeListener ( ISession session, IMessage message ) : void

Invokes the specified listener: either as standard NMS MessageListener or (preferably) as Spring SessionAwareMessageListener.

IsSessionLocallyTransacted ( ISession session ) : bool

Determines whether the given Session is locally transacted, that is, whether its transaction is managed by this listener container's Session handling and not by an external transaction coordinator.

The Session's own transacted flag will already have been checked before. This method is about finding out whether the Session's transaction is local or externally coordinated.

RollbackIfNecessary ( ISession session ) : void

Perform a rollback, if appropriate.

RollbackOnExceptionIfNecessary ( ISession session, Exception ex ) : void

Perform a rollback, handling rollback excepitons properly.

ValidateConfiguration ( ) : void

Validate that the destination is not null and that if the subscription is durable, then we are not using the Pub/Sub domain.

Method Details

CheckMessageListener() protected method

Checks the message listener, throwing an exception if it does not correspond to a supported listener type. By default, only a standard JMS MessageListener object or a Spring ISessionAwareMessageListener object will be accepted.
protected CheckMessageListener ( object messageListener ) : void
messageListener object The message listener.
return void

CommitIfNecessary() protected method

Perform a commit or message acknowledgement, as appropriate
In case of commit failure
protected CommitIfNecessary ( ISession session, IMessage message ) : void
session ISession The session to commit.
message IMessage The message to acknowledge.
return void

DoExecuteListener() protected method

Executes the specified listener, committing or rolling back the transaction afterwards (if necessary).
If thrown by NMS API methods.
protected DoExecuteListener ( ISession session, IMessage message ) : void
session ISession The session to operate on.
message IMessage The received message.
return void

DoInvokeListener() protected method

Invoke the specified listener as standard JMS MessageListener.
Default implementation performs a plain invocation of the OnMessage methods
if thrown by the NMS API methods
protected DoInvokeListener ( IMessageListener listener, IMessage message ) : void
listener IMessageListener The listener to invoke.
message IMessage The received message.
return void

DoInvokeListener() protected method

Invoke the specified listener as Spring SessionAwareMessageListener, exposing a new NMS Session (potentially with its own transaction) to the listener if demanded.
If thrown by NMS API methods.
protected DoInvokeListener ( ISessionAwareMessageListener listener, ISession session, IMessage message ) : void
listener ISessionAwareMessageListener The Spring ISessionAwareMessageListener to invoke.
session ISession The session to operate on.
message IMessage The received message.
return void

ExecuteListener() public method

Executes the specified listener, committing or rolling back the transaction afterwards (if necessary).
public ExecuteListener ( ISession session, IMessage message ) : void
session ISession The session to operate on.
message IMessage The received message.
return void

HandleListenerException() protected method

Handle the given exception that arose during listener execution.
The default implementation logs the exception at error level, not propagating it to the JMS provider - assuming that all handling of acknowledgement and/or transactions is done by this listener container. This can be overridden in subclasses.
protected HandleListenerException ( Exception ex ) : void
ex System.Exception The exceptin to handle
return void

InvokeErrorHandler() protected method

Invokes the error handler.
protected InvokeErrorHandler ( Exception exception ) : void
exception System.Exception The exception.
return void

InvokeExceptionListener() protected method

Invokes the registered exception listener, if any.
protected InvokeExceptionListener ( Exception ex ) : void
ex System.Exception The exception that arose during NMS processing.
return void

InvokeListener() protected method

Invokes the specified listener: either as standard NMS MessageListener or (preferably) as Spring SessionAwareMessageListener.
If thrown by NMS API methods.
protected InvokeListener ( ISession session, IMessage message ) : void
session ISession The session to operate on.
message IMessage The received message.
return void

IsSessionLocallyTransacted() protected method

Determines whether the given Session is locally transacted, that is, whether its transaction is managed by this listener container's Session handling and not by an external transaction coordinator.
The Session's own transacted flag will already have been checked before. This method is about finding out whether the Session's transaction is local or externally coordinated.
protected IsSessionLocallyTransacted ( ISession session ) : bool
session ISession The session to check.
return bool

RollbackIfNecessary() protected method

Perform a rollback, if appropriate.
In case of a rollback error
protected RollbackIfNecessary ( ISession session ) : void
session ISession The session to rollback.
return void

RollbackOnExceptionIfNecessary() protected method

Perform a rollback, handling rollback excepitons properly.
in case of a rollback error.
protected RollbackOnExceptionIfNecessary ( ISession session, Exception ex ) : void
session ISession The session to rollback.
ex System.Exception The thrown application exception.
return void

ValidateConfiguration() protected method

Validate that the destination is not null and that if the subscription is durable, then we are not using the Pub/Sub domain.
protected ValidateConfiguration ( ) : void
return void