Class JmsAsyncProducer
- java.lang.Object
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageProducer
,AdaptrisMessageSender
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,JmsActorConfig
,MessageEventGenerator
@ComponentProfile(summary="Place message on a JMS queue or topic asynchronously", tag="producer,jms", recommended=JmsConnection.class) public class JmsAsyncProducer extends JmsProducer
JMS 2.0 Producer implementation that extends all features ofJmsProducer
, but allows us to send messages asynchronously.
Be aware, you must have a JMS 2.0 compatible broker, this producer is not backward compatible to JMS 1.1Essentially the producer sending the message to the JMS provider will not wait for a response that would normally confirm the message has been received and persisted. Instead the producer sends the JMS message in a "fire-and-forget" manner.
At some future point in time, the JMS provider will call us back with confirmation or inform us of an error for each sent message.One of the benefits to sending messages asynchronously simply comes down to processing speed. During any producer, it is generally the time waiting for the JMS provider to return control back to the client after the client submits a message that takes the most time. With asynchronous message producing, we no longer have to wait for the JMS provider, allowing us to move onto the next message.
In the adapter configuration file this class is aliased as jms-async-producer which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.jms.JmsProducer
JmsProducer.MyJmsDestination
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description JmsAsyncProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JmsAsyncProducerEventHandler
getEventHandler()
void
init()
Initialises the component.protected void
produce(AdaptrisMessage msg, JmsDestination jmsDest)
void
setEventHandler(JmsAsyncProducerEventHandler eventHandler)
-
Methods inherited from class com.adaptris.core.jms.JmsProducer
buildDestination, createReplyTo, endpoint, getEndpoint, perMessageProperties, prepare, produce, produce, request, request, setEndpoint, vendorImplementation, waitForReply, withEndpoint
-
Methods inherited from class com.adaptris.core.jms.JmsProducerImpl
acknowledge, calculateDeliveryMode, calculatePriority, calculateTimeToLive, captureOutgoingMessageDetails, captureOutgoingMessageDetails, close, commit, configuredAcknowledgeMode, configuredCorrelationIdSource, configuredMessageListener, configuredMessageTranslator, currentLogger, currentSession, defaultTimeout, getAcknowledgeMode, getCaptureOutgoingMessageDetails, getCorrelationIdSource, getDeliveryMode, getMessageTranslator, getPerMessageProperties, getPriority, getSessionFactory, getTtl, isManagedTransaction, logLinkedException, messagePriority, producerSession, request, retrieveObjectDestination, rollback, rollbackTimeout, setAcknowledgeMode, setCaptureOutgoingMessageDetails, setCorrelationIdSource, setDeliveryMode, setMessageTranslator, setPerMessageProperties, setPriority, setSessionFactory, setTtl, setupSession, start, stop, timeToLive, transactedSession, translate
-
Methods inherited from class com.adaptris.core.RequestReplyProducerBase
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
-
Methods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createName
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
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.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
produce
protected void produce(AdaptrisMessage msg, JmsDestination jmsDest) throws javax.jms.JMSException, CoreException
- Overrides:
produce
in classJmsProducer
- Throws:
javax.jms.JMSException
CoreException
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Overrides:
init
in classJmsProducerImpl
- Throws:
CoreException
- wrapping any underlyingException
s
-
getEventHandler
public JmsAsyncProducerEventHandler getEventHandler()
-
setEventHandler
public void setEventHandler(JmsAsyncProducerEventHandler eventHandler)
-
-