public abstract class JmsProducerImpl extends RequestReplyProducerBase implements JmsActorConfig
log
Constructor and Description |
---|
JmsProducerImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
acknowledge(javax.jms.Message msg) |
protected int |
calculateDeliveryMode(AdaptrisMessage msg,
java.lang.String defaultDeliveryMode) |
protected int |
calculatePriority(AdaptrisMessage msg,
java.lang.Integer defaultPriority) |
protected long |
calculateTimeToLive(AdaptrisMessage msg,
java.lang.Long defaultTTL) |
protected boolean |
captureOutgoingMessageDetails() |
protected void |
captureOutgoingMessageDetails(javax.jms.Message jmsMsg,
AdaptrisMessage msg) |
void |
close()
Closes the component.
|
void |
commit() |
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.
|
protected javax.jms.Destination |
createDestination(ProduceDestination d,
AdaptrisMessage msg) |
org.slf4j.Logger |
currentLogger()
Return the configured logger.
|
javax.jms.Session |
currentSession()
Return the current jms session.
|
protected long |
defaultTimeout()
The default timeout for request messages when not supplied.
|
java.lang.String |
getAcknowledgeMode()
Returns the JMS acknowledge mode.
|
java.lang.Boolean |
getCaptureOutgoingMessageDetails() |
CorrelationIdSource |
getCorrelationIdSource()
Returns correlationIdSource.
|
java.lang.String |
getDeliveryMode()
Returns the JMS delivery mode.
|
MessageTypeTranslator |
getMessageTranslator()
Returns the
MessageTypeTranslator to use. |
java.lang.Boolean |
getPerMessageProperties() |
java.lang.Integer |
getPriority()
Returns the JMS priority.
|
ProducerSessionFactory |
getSessionFactory() |
java.lang.Long |
getTtl()
Returns the time to live.
|
void |
init()
Initialises the component.
|
boolean |
isManagedTransaction() |
protected void |
logLinkedException(java.lang.String prefix,
java.lang.Exception e) |
int |
messagePriority() |
boolean |
perMessageProperties() |
void |
prepare()
Prepare for initialisation.
|
protected ProducerSession |
producerSession() |
AdaptrisMessage |
request(AdaptrisMessage msg)
Produce the
AdaptrisMessage to the configured destination and blocks indefinitely for a reply. |
AdaptrisMessage |
request(AdaptrisMessage msg,
ProduceDestination destination)
Deprecated.
|
void |
rollback() |
long |
rollbackTimeout()
How long we should wait after a rollback before continuing on with
processing
|
void |
setAcknowledgeMode(java.lang.String s)
Sets the JMS acknowledge mode.
|
void |
setCaptureOutgoingMessageDetails(java.lang.Boolean b)
Specify whether or not to capture the outgoing message details as object metadata.
|
void |
setCorrelationIdSource(CorrelationIdSource c)
Sets correlationIdSource.
|
void |
setDeliveryMode(java.lang.String i)
Sets the JMS delivery mode.
|
void |
setMessageTranslator(MessageTypeTranslator translator)
Sets the
MessageTypeTranslator to use. |
void |
setPerMessageProperties(java.lang.Boolean b)
Specify message properties per message rather than per producer.
|
void |
setPriority(java.lang.Integer i)
Sets the JMS priority.
|
void |
setSessionFactory(ProducerSessionFactory s)
Set the behavioural characteristics of the session used by this producer.
|
void |
setTtl(java.lang.Long l)
Sets the time to live.
|
protected ProducerSession |
setupSession(AdaptrisMessage msg) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
long |
timeToLive() |
boolean |
transactedSession() |
protected javax.jms.Message |
translate(AdaptrisMessage msg,
javax.jms.Destination replyTo) |
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
createName, endpoint
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
request, request
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createQualifier, isTrackingEndpoint
produce, produce
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
CoreException
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
close
in interface ComponentLifecycle
protected long defaultTimeout()
RequestReplyProducerBase
defaultTimeout
in class RequestReplyProducerBase
@Deprecated @Removal(version="4.0.0") public AdaptrisMessage request(AdaptrisMessage msg, ProduceDestination destination) throws ProduceException
AdaptrisMessageProducer
AdaptrisMessage
to the passed supplied
ProduceDestination
and blocks indefinitely for a reply.request
in interface AdaptrisMessageProducer
msg
- the AdaptrisMessage
to producedestination
- the ProduceDestination
to produce toAdaptrisMessage
which is generally the same as
supplied parameterProduceException
- wrapping any underlying Exceptionspublic AdaptrisMessage request(AdaptrisMessage msg) throws ProduceException
AdaptrisMessageProducer
AdaptrisMessage
to the configured destination and blocks indefinitely for a reply.request
in interface AdaptrisMessageProducer
msg
- the AdaptrisMessage
to produceAdaptrisMessage
which is generally the same as supplied parameterProduceException
- wrapping any underlying Exceptionsprotected ProducerSession setupSession(AdaptrisMessage msg) throws javax.jms.JMSException
javax.jms.JMSException
protected void logLinkedException(java.lang.String prefix, java.lang.Exception e)
protected javax.jms.Destination createDestination(ProduceDestination d, AdaptrisMessage msg) throws CoreException
CoreException
protected int calculateDeliveryMode(AdaptrisMessage msg, java.lang.String defaultDeliveryMode)
protected long calculateTimeToLive(AdaptrisMessage msg, java.lang.Long defaultTTL) throws javax.jms.JMSException
javax.jms.JMSException
protected javax.jms.Message translate(AdaptrisMessage msg, javax.jms.Destination replyTo) throws javax.jms.JMSException
javax.jms.JMSException
protected int calculatePriority(AdaptrisMessage msg, java.lang.Integer defaultPriority)
public java.lang.String getDeliveryMode()
Returns the JMS delivery mode.
public void setDeliveryMode(java.lang.String i)
Sets the JMS delivery mode.
The value may be either "PERSISENT", "NON_PERSISTENT", or the int corresponding to the javax.jms.DeliveryMode constant.
i
- the JMS delivery modepublic java.lang.Integer getPriority()
Returns the JMS priority.
public void setPriority(java.lang.Integer i)
Sets the JMS priority. Valid values are 0 to 9.
i
- the JMS prioritypublic int messagePriority()
public java.lang.Long getTtl()
Returns the time to live. 0 means live forever.
public long timeToLive()
public void setTtl(java.lang.Long l)
Sets the time to live.
l
- the time to livepublic void setMessageTranslator(MessageTypeTranslator translator)
Sets the MessageTypeTranslator
to use.
translator
- the MessageTypeTranslator
to usepublic MessageTypeTranslator getMessageTranslator()
Returns the MessageTypeTranslator
to use.
MessageTypeTranslator
to usepublic void setAcknowledgeMode(java.lang.String s)
Sets the JMS acknowledge mode.
The value may be AUTO_KNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE or the int values corresponding to the JMS Session Constant
public java.lang.String getAcknowledgeMode()
Returns the JMS acknowledge mode.
public CorrelationIdSource getCorrelationIdSource()
Returns correlationIdSource.
public void setCorrelationIdSource(CorrelationIdSource c)
Sets correlationIdSource.
c
- the correlationIdSource to setpublic java.lang.Boolean getPerMessageProperties()
public void setPerMessageProperties(java.lang.Boolean b)
If set to true, then each message that is produced can have its own individual time-to-live, priority and delivery mode. These properties are taken from the producer's configuration but can be overriden via metadata.
b
- the perMessageProperties to setJmsConstants.JMS_PRIORITY
,
JmsConstants.JMS_DELIVERY_MODE
,
JmsConstants.JMS_EXPIRATION
public boolean perMessageProperties()
public void commit() throws javax.jms.JMSException
javax.jms.JMSException
public void rollback()
protected ProducerSession producerSession()
protected void acknowledge(javax.jms.Message msg) throws javax.jms.JMSException
javax.jms.JMSException
public CorrelationIdSource configuredCorrelationIdSource()
JmsActorConfig
configuredCorrelationIdSource
in interface JmsActorConfig
public MessageTypeTranslator configuredMessageTranslator()
JmsActorConfig
configuredMessageTranslator
in interface JmsActorConfig
public int configuredAcknowledgeMode()
JmsActorConfig
configuredAcknowledgeMode
in interface JmsActorConfig
public AdaptrisMessageListener configuredMessageListener()
JmsActorConfig
configuredMessageListener
in interface JmsActorConfig
public javax.jms.Session currentSession()
JmsActorConfig
currentSession
in interface JmsActorConfig
public org.slf4j.Logger currentLogger()
JmsActorConfig
currentLogger
in interface JmsActorConfig
public boolean transactedSession()
public long rollbackTimeout()
JmsActorConfig
rollbackTimeout
in interface JmsActorConfig
public boolean isManagedTransaction()
isManagedTransaction
in interface JmsActorConfig
protected boolean captureOutgoingMessageDetails()
public java.lang.Boolean getCaptureOutgoingMessageDetails()
public void setCaptureOutgoingMessageDetails(java.lang.Boolean b)
Some JMS providers may not make information such as Message.getJMSMessageID()
available
until the message is accepted for delivery by the provider. Set this to be true, if you need to
make use of that information later on in the workflow. All information captured is stored
against the object metadata key "javax.jms.Message.{propertyName}" e.g.
"javax.jms.Message.JMSMessageID" where JMSMessageID is derived from the associated
JmsConstants
constant.
b
- true to capture standard JMS Headers as object metadata post produce. If unspecified,
defaults to false.protected void captureOutgoingMessageDetails(javax.jms.Message jmsMsg, AdaptrisMessage msg)
public ProducerSessionFactory getSessionFactory()
public void setSessionFactory(ProducerSessionFactory s)
s
- the ProducerSessionFactory
instance, default is
DefaultProducerSessionFactory