Package com.adaptris.core.jms
Class AggregatingJmsConsumeService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.aggregator.AggregatingConsumeServiceImpl<JmsConnection>
-
- com.adaptris.core.jms.AggregatingJmsConsumeService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ConnectedService
,JmsActorConfig
,MessageEventGenerator
,Service
,AggregatingConsumeService<JmsConnection>
,StateManagedComponent
@ComponentProfile(summary="Allows you to aggregate messages from a JMS Queue", tag="service,aggregation,jms", recommended=JmsConnection.class) public class AggregatingJmsConsumeService extends AggregatingConsumeServiceImpl<JmsConnection> implements JmsActorConfig, ConnectedService
Implentation ofAggregatingConsumeService
that allows you to consume a related message from a queue based on some criteria.In the adapter configuration file this class is aliased as aggregating-jms-consume-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description AggregatingJmsConsumeService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
int
configuredAcknowledgeMode()
Return the current acknowledge mode.CorrelationIdSource
configuredCorrelationIdSource()
Return the current correlation id source.AdaptrisMessageListener
configuredMessageListener()
return the current configured MessageListener.MessageTypeTranslator
configuredMessageTranslator()
Return the currently configured messageTranslator.org.slf4j.Logger
currentLogger()
Return the configured logger.javax.jms.Session
currentSession()
Return the current jms session.void
doService(AdaptrisMessage msg)
Apply the service to the message.AdaptrisConnection
getConnection()
Returns theAdaptrisConnection
to use.AggregatingJmsConsumer
getJmsConsumer()
protected void
initService()
boolean
isManagedTransaction()
void
prepare()
Prepare for initialisation.long
rollbackTimeout()
How long we should wait after a rollback before continuing on with processingvoid
setConnection(AdaptrisConnection connection)
Sets theAdaptrisConnection
to use.void
setJmsConsumer(AggregatingJmsConsumer consumer)
void
start()
Starts the component.void
stop()
Stop the component-
Methods inherited from class com.adaptris.core.services.aggregator.AggregatingConsumeServiceImpl
start, stop
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
initService
protected void initService() throws CoreException
- Overrides:
initService
in classAggregatingConsumeServiceImpl<JmsConnection>
- Throws:
CoreException
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Specified by:
start
in interfaceComponentLifecycle
- Overrides:
start
in classAggregatingConsumeServiceImpl<JmsConnection>
- Throws:
CoreException
- wrapping any underlyingException
s
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences- Specified by:
stop
in interfaceComponentLifecycle
- Overrides:
stop
in classAggregatingConsumeServiceImpl<JmsConnection>
-
closeService
protected void closeService()
- Overrides:
closeService
in classAggregatingConsumeServiceImpl<JmsConnection>
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Specified by:
prepare
in interfaceComponentLifecycleExtension
- Throws:
CoreException
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Specified by:
doService
in interfaceService
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
configuredMessageTranslator
public MessageTypeTranslator configuredMessageTranslator()
Description copied from interface:JmsActorConfig
Return the currently configured messageTranslator.- Specified by:
configuredMessageTranslator
in interfaceJmsActorConfig
- Returns:
- the MessageTypeTranslator instance.
-
configuredAcknowledgeMode
public int configuredAcknowledgeMode()
Description copied from interface:JmsActorConfig
Return the current acknowledge mode.- Specified by:
configuredAcknowledgeMode
in interfaceJmsActorConfig
- Returns:
- the session acknowledge mode.
-
configuredCorrelationIdSource
public CorrelationIdSource configuredCorrelationIdSource()
Description copied from interface:JmsActorConfig
Return the current correlation id source.- Specified by:
configuredCorrelationIdSource
in interfaceJmsActorConfig
- Returns:
- the correlation id source
-
configuredMessageListener
public AdaptrisMessageListener configuredMessageListener()
Description copied from interface:JmsActorConfig
return the current configured MessageListener.- Specified by:
configuredMessageListener
in interfaceJmsActorConfig
- Returns:
- the adaptris message listener instance.
-
currentSession
public javax.jms.Session currentSession()
Description copied from interface:JmsActorConfig
Return the current jms session.- Specified by:
currentSession
in interfaceJmsActorConfig
- Returns:
- the current javax.jms.Session
-
currentLogger
public org.slf4j.Logger currentLogger()
Description copied from interface:JmsActorConfig
Return the configured logger.- Specified by:
currentLogger
in interfaceJmsActorConfig
- Returns:
- the logger.
-
rollbackTimeout
public long rollbackTimeout()
Description copied from interface:JmsActorConfig
How long we should wait after a rollback before continuing on with processing- Specified by:
rollbackTimeout
in interfaceJmsActorConfig
- Returns:
- the timeout in ms.
-
getJmsConsumer
public AggregatingJmsConsumer getJmsConsumer()
-
setJmsConsumer
public void setJmsConsumer(AggregatingJmsConsumer consumer)
-
getConnection
public AdaptrisConnection getConnection()
Description copied from interface:ConnectedService
Returns theAdaptrisConnection
to use.- Specified by:
getConnection
in interfaceConnectedService
- Returns:
- the
AdaptrisConnection
-
setConnection
public void setConnection(AdaptrisConnection connection)
Description copied from interface:ConnectedService
Sets theAdaptrisConnection
to use.- Specified by:
setConnection
in interfaceConnectedService
- Parameters:
connection
- theAdaptrisConnection
to use
-
isManagedTransaction
public boolean isManagedTransaction()
- Specified by:
isManagedTransaction
in interfaceJmsActorConfig
- Returns:
- whether we are in a managed (XA) transaction
-
-