@ComponentProfile(summary="Place message on a JMS Topic", tag="producer,jms", recommended=JmsConnection.class) public class PasProducer extends DefinedJmsProducer
AdaptrisMessageProducer
implementation for Topic based JMS.
This implementation baselines to JMS 1.1 for minimum API support and its behaviour and support for standard JMS Headers can be controlled in a number of ways.
When converting from an AdaptrisMessage
into a standard Message
; you
should choose an implementation of MessageTypeTranslator
. The more common types are
BytesMessageTranslator
, TextMessageTranslator
, ObjectMessageTranslator
and MapMessageTranslator
which correspond to BytesMessage
,
TextMessage
, ObjectMessage
and MapMessage
respectively. Each MessageTypeTranslator
will allow you to move some or all metadata from
the AdaptrisMessage to the JMS Message. Of course, there are other vendor specific JMS message
types can be used.
The Message.getJMSCorrelationID()
field is generally used for linking one
message to with another. It typically links a reply message with the originating request message.
If you need to handle the correlation id in some fashion then typically you would choose an
implementation of CorrelationIdSource
that explicitly handles the correlation ID; for
instance MetadataCorrelationIdSource
.
Synchronous request/reply messaging behaviour is available for this producer and relies heavily
on the Message.getJMSReplyTo()
field. Normally if the adapter is initiating the
request then a temporary destination is created and this is used as the JMSReplyTo field.
Sometimes you may wish to specify your own JMSReplyTo field (where the JMS Vendor doesn't play
nice with temporary topics). To do this, then you need to ensure that the metadata key
"JMSAsyncStaticReplyTo" is set with the appropriate
queue name; this will cause that message to be produced to the topic with a JMSReplyTo set to
that topic name. You may also use
"JMSAsyncStaticReplyTo" in an asynchronous
workflow; if the metadata key exists in the message then it will be used to populate the
JMSReplyTo Field.
By convention, the Message.getJMSPriority()
,
Message.getJMSDeliveryMode()
, and Message.getJMSExpiration()
are configured directly (expiration here is semantically equivalent to the element
JmsProducerImpl.setTtl(Long)
on the producer. It is possible to control it dynamically on a per message
basis using the element JmsProducerImpl.setPerMessageProperties(Boolean)
. If you opt to control these
fields on a per message basis then the following metadata keys are used :
DeliveryMode
In the adapter configuration file this class is aliased as jms-topic-producer which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
PasProducer() |
Modifier and Type | Method and Description |
---|---|
protected javax.jms.Topic |
createDestination(java.lang.String name) |
protected javax.jms.Destination |
createTemporaryDestination() |
java.lang.String |
endpoint(AdaptrisMessage msg)
Return the endpoint that will be derived from the message.
|
ProduceDestination |
getDestination()
Deprecated.
|
java.lang.String |
getTopic()
The JMS Topic
|
void |
prepare()
Prepare for initialisation.
|
void |
produce(AdaptrisMessage msg)
Produces the
AdaptrisMessage to the default destination. |
AdaptrisMessage |
request(AdaptrisMessage msg,
long timeout)
Produces the
AdaptrisMessage to the configured ProduceDestination and blocks for the specified timeout for a
reply. |
void |
setDestination(ProduceDestination destination)
Deprecated.
|
void |
setTopic(java.lang.String topic)
The JMS Topic
|
PasProducer |
withDestination(ProduceDestination t)
Deprecated.
|
PasProducer |
withTopic(java.lang.String t) |
doProduce, doProduce, produce, request
acknowledge, calculateDeliveryMode, calculatePriority, calculateTimeToLive, captureOutgoingMessageDetails, captureOutgoingMessageDetails, close, commit, configuredAcknowledgeMode, configuredCorrelationIdSource, configuredMessageListener, configuredMessageTranslator, createDestination, currentLogger, currentSession, defaultTimeout, getAcknowledgeMode, getCaptureOutgoingMessageDetails, getCorrelationIdSource, getDeliveryMode, getMessageTranslator, getPerMessageProperties, getPriority, getSessionFactory, getTtl, init, isManagedTransaction, logLinkedException, messagePriority, perMessageProperties, producerSession, request, request, rollback, rollbackTimeout, setAcknowledgeMode, setCaptureOutgoingMessageDetails, setCorrelationIdSource, setDeliveryMode, setMessageTranslator, setPerMessageProperties, setPriority, setSessionFactory, setTtl, setupSession, start, stop, timeToLive, transactedSession, translate
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
createName
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
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createQualifier, isTrackingEndpoint
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
prepare
in class JmsProducerImpl
CoreException
protected javax.jms.Topic createDestination(java.lang.String name) throws javax.jms.JMSException
createDestination
in class DefinedJmsProducer
javax.jms.JMSException
protected javax.jms.Destination createTemporaryDestination() throws javax.jms.JMSException
createTemporaryDestination
in class DefinedJmsProducer
javax.jms.JMSException
public AdaptrisMessage request(AdaptrisMessage msg, long timeout) throws ProduceException
AdaptrisMessageProducer
AdaptrisMessage
to the configured ProduceDestination
and blocks for the specified timeout for a
reply.msg
- the AdaptrisMessage
to producetimeout
- the time to wait for a reply in millisecondsAdaptrisMessage
which is generally the same as supplied parameterProduceException
- wrapping any underlying Exceptionspublic void produce(AdaptrisMessage msg) throws ProduceException
AdaptrisMessageSender
AdaptrisMessage
to the default destination.msg
- the @link AdaptrisMessage} to produceProduceException
- wrapping any underlying Exceptionspublic java.lang.String endpoint(AdaptrisMessage msg) throws ProduceException
AdaptrisMessageProducerImp
The purpose of this method is to mitigate the number of changes that need to happen because
ProduceDestination
is being deprecated; boilerplate code can still be present in the
parent super-classes w/o impacting concrete sub-classes "too much".
endpoint
in class AdaptrisMessageProducerImp
ProduceException
AdaptrisMessageProducer.request(AdaptrisMessage, ProduceDestination)
,
AdaptrisMessageProducer.request(AdaptrisMessage, ProduceDestination, long)
,
AdaptrisMessageSender.produce(AdaptrisMessage)
,
AdaptrisMessageSender.produce(AdaptrisMessage, ProduceDestination)
public PasProducer withTopic(java.lang.String t)
@Deprecated public PasProducer withDestination(ProduceDestination t)
@Deprecated public ProduceDestination getDestination()
Note that this is deprecated, but you may need to use something like
JmsReplyToDestination
until support is available directly using string expressions.
@Deprecated public void setDestination(ProduceDestination destination)
Note that this is deprecated, but you may need to use something like
JmsReplyToDestination
until support is available directly using string expressions.
public java.lang.String getTopic()
public void setTopic(java.lang.String topic)