Creating a JMS Trigger
About this task
- The
JMS connection alias you want
Integration Server to use to obtain connections to and receive messages from
the JMS provider must already exist. Although a JMS connection alias does not
need to be enabled at the time you create the JMS trigger, the JMS connection
alias must be enabled for the JMS trigger to execute at run time.
Note: If you want to manage destinations and durable subscribers on a webMethods Broker that is used as a JMS provider, the JMS connection alias must be enabled when you work with the JMS trigger.
- If you use a JNDI provider to store JMS administered objects, the Connection Factories that you want the JMS trigger to use to consume messages must already exist.
- If you
use a JNDI provider to store JMS administered objects and the JMS provider is
not
webMethods Broker, the destinations (queues and topics) from which this JMS
trigger will receive messages must already exist.
Note: webMethods Broker is deprecated.
- If the JMS provider is webMethods Broker or Software AG Universal Messaging, the destinations (queues and topics) from which the JMS trigger receives messages do not need to exist before you create the JMS trigger. Instead, you can create destinations using the JMS trigger editor. You can also create, modify, and delete durable subscribers via the JMS trigger. For more information, see Managing Destinations and Durable Subscribers on the JMS Provider through Designer.
- If the JMS provider is Universal Messaging, administered objects can be created on demand. If you specify a destination that does not exist in the JNDI namespace and the JMS connection alias used by the JMS trigger is configured to create administered objects on demand, Integration Server creates the destination the first time the JMS trigger starts. For more information about creating administered objects on demand, see webMethods Integration Server Administrator’s Guide .
- The transaction type of the JMS connection alias determines whether or not the JMS trigger is transacted (that is, it receives and processes messages as part of a transaction). Transacted JMS triggers have slightly different properties and operate differently than non-transacted JMS triggers. For more information about building a transacted JMS trigger, see Building a Transacted JMS Trigger.
- The trigger service that you want to specify in the routing rule must already exist on the same Integration Server on which you create the JMS trigger. For more information, see Standard JMS Trigger Service Requirements.
- A standard JMS trigger can contain multiple routing rules. Each routing rule must have a unique name. For more information about using multiple routing rules, see Building Standard JMS Triggers with Multiple Routing Rules.
- A standard JMS trigger that contains an All (AND) or Only one (XOR) join can only have one routing rule and cannot have a batch processing size (Max batch messages property) greater than 1. A JMS trigger with an Any (Or) join can have multiple routing rules. For more information about batch processing, see About Batch Processing for Standard JMS Triggers.
- Integration Server uses a consumer to receive messages for a JMS trigger. This consumer encapsulates the actual javax.jms.MessageConsumer and javax.jms.Session.
To create a JMS trigger
Procedure
Adding JMS Destinations and Message Selectors to a JMS Trigger
About this task
To add a JMS destination to a JMS trigger
Procedure
Results
- If you specify a new durable subscriber name and the JMS connection alias that the JMS trigger uses to retrieve messages is configured to manage destinations, Integration Server creates a durable subscriber for the topic when the JMS trigger is first enabled.
- If you specify a destination type of Topic (Durable Subscriber) but do not specify a durable subscriber name, Designer changes the destination type to Topic when you save the JMS trigger.
Creating a Destination on the JMS Provider
About this task
Keep the following points in mind when creating destinations using Designer:
- The JMS connection alias used by the
JMS trigger must use
Universal Messaging,
Nirvana, or
webMethods Broker as the JMS provider.
Note: Prior to version 9.5 SP1, Software AG Universal Messaging was named webMethods Nirvana.
- The JMS connection alias used by the JMS trigger must be configured to manage destinations.
- The JMS connection alias must be enabled when you work with the JMS trigger.
- If the JMS connection alias creates a connection on a webMethods Broker in a webMethods Broker cluster, you will not be able to create a destination at the webMethods Broker.
To create a destination on the JMS provider
Procedure
Results
-
Integration Server adds the new destination to the webMethods Broker as a shared-state client.
- If you specify a destination type of Topic (Durable Subscriber) but do not specify a durable subscriber name, Designer changes the destination type to Topic when you save the JMS trigger.
About Durable and Non-Durable Subscribers
When a JMS trigger receives messages from a topic, you can specify whether or not the JMS trigger is a durable subscriber.
A durable subscriber establishes a durable subscription with a unique identity on the JMS provider. A durable subscription allows subscribers to receive all the messages published on a topic, including those published while the subscriber is inactive (for example, if the JMS trigger is disabled). When the associated JMS trigger is disabled, the JMS provider holds the messages in guaranteed storage. If a durable subscription already exists for the specified durable subscriber on the JMS provider, this service resumes the subscription.
A non-durable subscription allows subscribers to receive messages on their chosen topic only if the messages are published while the subscriber is active. A non-durable subscription lasts the lifetime of its message consumer. Note that non-durable subscribers cannot receive messages in a load-balanced fashion.
Creating a Message Selector
If you want the JMS trigger to receive a subset of messages from a specified destination, create a message selector. A message selector is an expression that specifies the criteria for the messages in which the JMS trigger is interested.
The JMS provider applies the message selector to messages it receives. If the selector evaluates to true, the message is sent to the JMS trigger. If the selector evaluates to false, the message is not sent to the JMS trigger.
By creating message selectors, you can delegate some filtering work to the JMS provider. This can preserve Integration Server resources that otherwise would have been spent receiving and processing unwanted messages.
The message selector must use the message selector syntax specified in the Java Message Service standard. The message selector can reference header and property fields in the JMS message only.
Adding Routing Rules to a Standard JMS Trigger
About this task
To add a routing rule to a standard JMS trigger
Procedure
- In the Package Navigator view of Designer, open the JMS trigger.
-
In the Trigger Settings tab, under
Message
routing, click
to add a new routing rule.
- In the Name column, type a name for the routing rule. By default Designer assigns the first rule the name “Rule 1”.
-
In the
Service
column, click
to navigate to and select the
service that you want to invoke when
Integration Server receives messages from the specified destinations.
-
In the
Local
Filter column, click
to enter the filter that you want
Integration Server to apply to messages this JMS trigger receives. For more
information about creating a local filter, see
Creating a Local Filter.
- Click File > Save.
Creating a Local Filter
You can further refine the messages received and processed by a standard JMS trigger by creating local filters. A local filter specifies criteria for the contents of the message body. Integration Server applies a local filter to a message after the JMS trigger receives the message from the JMS provider. If the message meets the filter criteria, Integration Server executes the trigger service specified in the routing rule. If the message does not meet the filter criteria, Integration Server discards the message and acknowledges the message to the JMS provider.
If a JMS trigger contains multiple routing rules to support ordered service execution, you can use local filters to process a series of messages in a particular order. For more information about ordered service execution, see Building Standard JMS Triggers with Multiple Routing Rules.
When creating a local filter, you can omit the JMSMessage document from the filter expression even though it is part of the pipeline provided to the JMS trigger service. For example, a filter that matches those messages where the value of the myField field is “XYZ” would look like the following:
%properties/myField% == "XYZ"
Note that even though the properties field is a child of the JMSMessage document, the JMSMessage document does not need to appear in the filter expression.
The following filter matches those messages where the data document within the JMSMessage/body document contains a field named myField whose value is “A”:
%body/data/myField% == "A"