@VisitBeforeIf(condition="parameters.containsKey(\'executeBefore\') && parameters.executeBefore.value == \'true\'") @VisitAfterIf(condition="!parameters.containsKey(\'executeBefore\') || parameters.executeBefore.value != \'true\'") public class JMSRouter extends Object implements DOMElementVisitor, SAXVisitBefore, SAXVisitAfter, Consumer
<resource-config selector="orderItems"> <resource>org.milyn.routing.jms.JMSRouter</resource> <param name="beanId">beanId</param> <param name="destinationName">/queue/smooksRouterQueue</param> </resource-config> .... Optional parameters: <param name="executeBefore">true</param> <param name="jndiContextFactory">ConnectionFactory</param> <param name="jndiProviderUrl">jnp://localhost:1099</param> <param name="jndiNamingFactory">org.jboss.naming:java.naming.factory.url.pkgs=org.jnp.interfaces</param> <param name="connectionFactory">ConnectionFactory</param> <param name="deliveryMode">persistent</param> <param name="priority">10</param> <param name="timeToLive">100000</param> <param name="securityPrincipal">username</param> <param name="securityCredential">password</param> <param name="acknowledgeMode">AUTO_ACKNOWLEDGE</param> <param name="transacted">false</param> <param name="correlationIdPattern">orderitem-${order.orderId}-${order.orderItem.itemId}</param> <param name="messageType">ObjectMessage</param> <param name="highWaterMark">50</param> <param name="highWaterMarkTimeout">5000</param> <param name="highWaterMarkPollFrequency">500</param>Description of configuration properties:
Constructor and Description |
---|
JMSRouter() |
Modifier and Type | Method and Description |
---|---|
protected void |
close(javax.jms.Connection connection) |
protected void |
close(javax.jms.Session session) |
boolean |
consumes(Object object)
Does this consumer consume the specified named object.
|
protected javax.jms.MessageProducer |
createMessageProducer(javax.jms.Destination destination,
Context context) |
String |
getAcknowledgeMode() |
String |
getConnectionFactoryName() |
String |
getDeliveryMode() |
javax.jms.Destination |
getDestination() |
String |
getDestinationName() |
String |
getJndiContextFactory() |
String |
getJndiNamingFactoryUrl() |
String |
getJndiProviderUrl() |
int |
getPriority() |
String |
getSecurityCredential() |
String |
getSecurityPrincipal() |
long |
getTimeToLive() |
void |
initialize() |
boolean |
isTransacted() |
protected void |
sendMessage(javax.jms.Message message) |
void |
setAcknowledgeMode(String jmsAcknowledgeMode) |
void |
setBeanId(String beanId) |
void |
setConnectionFactoryName(String connectionFactoryName) |
void |
setCorrelationIdPattern(String correlationIdPattern) |
void |
setDeliveryMode(String deliveryMode) |
void |
setDestinationName(String destinationName) |
void |
setHighWaterMark(int highWaterMark) |
void |
setHighWaterMarkPollFrequency(long highWaterMarkPollFrequency) |
void |
setHighWaterMarkTimeout(long highWaterMarkTimeout) |
void |
setJndiContextFactory(String contextFactory) |
void |
setJndiNamingFactoryUrl(String pkgUrl) |
void |
setJndiProperties(Properties properties) |
void |
setJndiProperties(String propertiesFile) |
void |
setJndiProviderUrl(String providerUrl) |
protected void |
setMessageProducerProperties()
Sets the following MessageProducer properties:
|
void |
setMessageType(String messageType) |
void |
setMsgCreationStrategy(MessageCreationStrategy msgCreationStrategy) |
void |
setPriority(int priority) |
void |
setSecurityCredential(String securityCredential) |
void |
setSecurityPrincipal(String securityPrincipal) |
void |
setTimeToLive(long timeToLive) |
void |
setTransacted(boolean transacted) |
void |
uninitialize() |
void |
visitAfter(Element element,
ExecutionContext execContext)
Visit the supplied element after visiting its child elements.
|
void |
visitAfter(SAXElement element,
ExecutionContext execContext)
Visit the supplied element after visiting its child elements.
|
void |
visitBefore(Element element,
ExecutionContext execContext)
Visit the supplied element before visiting its child elements.
|
void |
visitBefore(SAXElement element,
ExecutionContext execContext)
Visit the supplied element before visiting its child elements.
|
@Initialize public void initialize() throws SmooksConfigurationException, javax.jms.JMSException
SmooksConfigurationException
javax.jms.JMSException
@Uninitialize public void uninitialize() throws javax.jms.JMSException
javax.jms.JMSException
public boolean consumes(Object object)
Consumer
Producer
that is executing
on the same element. The consumer should only return false
if it knows for
certain that it doesn't consumer the specified named object. If uncertain, it should
error on the side of saying that it does consume the object.public void setBeanId(String beanId)
public void setCorrelationIdPattern(String correlationIdPattern)
public void setHighWaterMark(int highWaterMark)
public void setHighWaterMarkTimeout(long highWaterMarkTimeout)
public void setHighWaterMarkPollFrequency(long highWaterMarkPollFrequency)
@ConfigParam(use=OPTIONAL) public void setJndiContextFactory(String contextFactory)
@ConfigParam(use=OPTIONAL) public void setJndiProperties(String propertiesFile)
public void setJndiProperties(Properties properties)
@ConfigParam(use=OPTIONAL) public void setJndiProviderUrl(String providerUrl)
@ConfigParam(use=OPTIONAL) public void setJndiNamingFactoryUrl(String pkgUrl)
@ConfigParam(use=REQUIRED) public void setDestinationName(String destinationName)
@ConfigParam(choice={"persistent","non-persistent"}, defaultVal="persistent", use=OPTIONAL) public void setDeliveryMode(String deliveryMode)
@ConfigParam(use=OPTIONAL) public void setTimeToLive(long timeToLive)
@ConfigParam(use=OPTIONAL) public void setSecurityPrincipal(String securityPrincipal)
@ConfigParam(use=OPTIONAL) public void setSecurityCredential(String securityCredential)
@ConfigParam(use=OPTIONAL, defaultVal="false") public void setTransacted(boolean transacted)
@ConfigParam(defaultVal="ConnectionFactory", use=OPTIONAL) public void setConnectionFactoryName(String connectionFactoryName)
@ConfigParam(use=OPTIONAL) public void setPriority(int priority)
@ConfigParam(defaultVal="AUTO_ACKNOWLEDGE", choice={"AUTO_ACKNOWLEDGE","CLIENT_ACKNOWLEDGE","DUPS_OK_ACKNOWLEDGE"}) public void setAcknowledgeMode(String jmsAcknowledgeMode)
@ConfigParam(defaultVal="TextMessage", choice={"TextMessage","ObjectMessage"}) public void setMessageType(String messageType)
public void visitAfter(Element element, ExecutionContext execContext) throws SmooksException
DOMVisitAfter
visitAfter
in interface DOMVisitAfter
element
- The DOM element being visited.execContext
- Request relative instance.SmooksException
- Element processing failure.public void visitBefore(Element element, ExecutionContext execContext) throws SmooksException
DOMVisitBefore
visitBefore
in interface DOMVisitBefore
element
- The DOM element being visited.execContext
- Request relative instance.SmooksException
- Element processing failure.public void visitAfter(SAXElement element, ExecutionContext execContext) throws SmooksException, IOException
SAXVisitAfter
visitAfter
in interface SAXVisitAfter
element
- The SAX element being visited.execContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void visitBefore(SAXElement element, ExecutionContext execContext) throws SmooksException, IOException
SAXVisitBefore
visitBefore
in interface SAXVisitBefore
element
- The SAX element being visited.execContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.protected javax.jms.MessageProducer createMessageProducer(javax.jms.Destination destination, Context context) throws javax.jms.JMSException
javax.jms.JMSException
protected void setMessageProducerProperties() throws SmooksConfigurationException
Subclasses may override this behaviour.
SmooksConfigurationException
protected void sendMessage(javax.jms.Message message) throws SmooksRoutingException
SmooksRoutingException
protected void close(javax.jms.Connection connection)
protected void close(javax.jms.Session session)
public javax.jms.Destination getDestination()
public String getJndiContextFactory()
public String getJndiProviderUrl()
public String getJndiNamingFactoryUrl()
public String getDestinationName()
public String getDeliveryMode()
public long getTimeToLive()
public String getSecurityPrincipal()
public String getSecurityCredential()
public boolean isTransacted()
public String getConnectionFactoryName()
public int getPriority()
public String getAcknowledgeMode()
public void setMsgCreationStrategy(MessageCreationStrategy msgCreationStrategy)
Copyright © 2020. All rights reserved.