@ComponentProfile(summary="Place message on a JMS queue or topic", tag="producer,jms", recommended=JmsConnection.class) public class JmsProducer extends JmsProducerImpl
This differs from the standard PtpProducer
and PasProducer
in that it supports a
destination that is specified in RFC6167 style. For instance jms:queue:myQueueName
will
produce to a queue called myQueueName
and jms:topic:myTopicName
to a topic called
myTopicName
While RFC6167 defines the ability to use jndi to lookup the (as part of the 'jndi' variant section); this is not supported. The standard deliveryMode, timeToLive, priority, replyToName properties are supported. If not specified, then they will be inherited from the producers configuration. For instance you could have the following destinations:
As the RFC6167 string can specify priority, timeToLive and deliveryMode; this producer defaults
JmsProducerImpl.getPerMessageProperties()
to be true.
In the adapter configuration file this class is aliased as jms-producer which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Class and Description |
---|---|
protected class |
JmsProducer.MyJmsDestination |
log
Constructor and Description |
---|
JmsProducer() |
Modifier and Type | Method and Description |
---|---|
protected JmsDestination |
buildDestination(ProduceDestination dest,
AdaptrisMessage msg,
boolean createReplyTo)
Build a JMSDestination.
|
protected javax.jms.Destination |
createReplyTo(AdaptrisMessage msg,
JmsDestination target,
boolean createTmpDest)
Create a Destination for JMSReplyTo if one doesn't already exist or if
JMS_ASYNC_STATIC_REPLY_TO exists as metadata. |
java.lang.String |
endpoint(AdaptrisMessage msg)
Return the endpoint that will be derived from the message.
|
ProduceDestination |
getDestination()
Deprecated.
|
java.lang.String |
getEndpoint()
The JMS Endpoint defined in an RFC6167 manner.
|
boolean |
perMessageProperties() |
void |
prepare()
Prepare for initialisation.
|
void |
produce(AdaptrisMessage msg)
Produces the
AdaptrisMessage to the default destination. |
protected void |
produce(AdaptrisMessage msg,
JmsDestination jmsDest) |
void |
produce(AdaptrisMessage msg,
ProduceDestination dest)
Deprecated.
|
AdaptrisMessage |
request(AdaptrisMessage msg,
long timeout)
Produces the
AdaptrisMessage to the configured ProduceDestination and blocks for the specified timeout for a
reply. |
AdaptrisMessage |
request(AdaptrisMessage msg,
ProduceDestination dest,
long timeout)
Deprecated.
|
void |
setDestination(ProduceDestination destination)
Deprecated.
|
void |
setEndpoint(java.lang.String endpoint)
The JMS Endpoint defined in an RFC6167 manner.
|
protected <T extends VendorImplementationBase> |
vendorImplementation() |
protected AdaptrisMessage |
waitForReply(javax.jms.MessageConsumer receiver,
long timeout)
Wait for a reply.
|
<T extends JmsProducer> |
withEndpoint(java.lang.String s) |
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, 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
@Deprecated @Removal(version="4.0.0") public void produce(AdaptrisMessage msg, ProduceDestination dest) throws ProduceException
AdaptrisMessageSender
AdaptrisMessage
to the supplied
ProduceDestination
, over-riding any configured destinations.msg
- the AdaptrisMessage
to producedest
- the ProduceDestination
to produce toProduceException
- wrapping any underlying Exceptionsprotected void produce(AdaptrisMessage msg, JmsDestination jmsDest) throws javax.jms.JMSException, CoreException
javax.jms.JMSException
CoreException
@Deprecated @Removal(version="4.0.0") public AdaptrisMessage request(AdaptrisMessage msg, ProduceDestination dest, long timeout) throws ProduceException
AdaptrisMessageProducer
AdaptrisMessage
to the passed supplied
ProduceDestination
and blocks for the specified timeout for a reply.msg
- the AdaptrisMessage
to producedest
- the ProduceDestination
to produce totimeout
- the time to wait for a reply in millisecondsAdaptrisMessage
which is generally the same as
supplied parameterProduceException
- wrapping any underlying Exceptionsprotected AdaptrisMessage waitForReply(javax.jms.MessageConsumer receiver, long timeout) throws javax.jms.JMSException
receiver
- the MessageConsumer
timeout
- the timeout (ms)javax.jms.JMSException
- on Exception (including a timeout exception).protected JmsDestination buildDestination(ProduceDestination dest, AdaptrisMessage msg, boolean createReplyTo) throws javax.jms.JMSException, CoreException
dest
- the ProduceDestinationmsg
- the messagecreateReplyTo
- - passed through to
createReplyTo(AdaptrisMessage, JmsDestination, boolean)
javax.jms.JMSException
CoreException
protected javax.jms.Destination createReplyTo(AdaptrisMessage msg, JmsDestination target, boolean createTmpDest) throws javax.jms.JMSException
JMS_ASYNC_STATIC_REPLY_TO
exists as metadata.msg
- the message (which will be checked for JMS_ASYNC_STATIC_REPLY_TO
.createTmpDest
- - create a temporary destination if JMS_ASYNC_STATIC_REPLY_TO
isn't available.javax.jms.JMSException
protected <T extends VendorImplementationBase> T vendorImplementation()
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 boolean perMessageProperties()
perMessageProperties
in class JmsProducerImpl
public <T extends JmsProducer> T withEndpoint(java.lang.String s)
@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 getEndpoint()
public void setEndpoint(java.lang.String endpoint)