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
Afficher le fichier Open project: spring-projects/spring-net Class Usage Examples

Méthodes publiques

Méthode Description
ExecuteListener ( ISession session, IMessage message ) : void

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

Méthodes protégées

Méthode 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 méthode

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.
Résultat void

CommitIfNecessary() protected méthode

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.
Résultat void

DoExecuteListener() protected méthode

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.
Résultat void

DoInvokeListener() protected méthode

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.
Résultat void

DoInvokeListener() protected méthode

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.
Résultat void

ExecuteListener() public méthode

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.
Résultat void

HandleListenerException() protected méthode

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
Résultat void

InvokeErrorHandler() protected méthode

Invokes the error handler.
protected InvokeErrorHandler ( Exception exception ) : void
exception System.Exception The exception.
Résultat void

InvokeExceptionListener() protected méthode

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

InvokeListener() protected méthode

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.
Résultat void

IsSessionLocallyTransacted() protected méthode

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.
Résultat bool

RollbackIfNecessary() protected méthode

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

RollbackOnExceptionIfNecessary() protected méthode

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.
Résultat void

ValidateConfiguration() protected méthode

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
Résultat void