Using the Suppressible Attribute for a Static Subscription

A static subscription to a Message Broker channel can be specified as suppressible by setting the suppressible attribute for the subscription in the business process. Valid values for suppressible are true and false (the default). Setting suppressible to true specifies that the static subscription is suppressed in favor of dynamic subscriptions. In other words, you can prevent specific messages on a Message Broker channel from starting a new business process; instead the messages can be received, using a dynamic subscription, by a business process that is already running.

A typical use for the suppressible attribute is to design the routing of messages that have the same group ID to the same business process. An ideal scenario is to use a JMS property of messages handled by a JMS event generator as the group ID.

Designing such a scenario includes setting up the business process and the event generators, as described in the following sections:

Setting up the Business Process

In this example, we use a JMS property of messages handled by a JMS event generator as the group ID. We design the routing of messages with the same group ID to the same business process.

The following code example shows the property in the JMS event generator:

<JmsEventGenerator> 
	<property> 
		<Name>GROUPID</Name> 
		<Value>100</Value> 
	</property> 
	... 
</JmsEventGenerator> 

To Create a Business Process that Receives all Messages With the Same GROUPID Property Sent on a Specific Message Broker Channel

  1. Design your business process to be started when it receives a message from a Message Broker channel to which it is subscribed. To learn how, see Subscription Start (Synchronous).
  2. Note: In this example, we use a channel named /my/orders.

  3. Set the suppressible attribute to true. To do so:
    1. With the business process opened in the WebLogic Workshop graphical design environment, click the Source View tab, and locate the static subscription method in the source code. It is preceded by the following JPD annotation:
    2. @jpd:mb-static-subscription 
      
    3. Click anywhere inside the static subscription method. The Property Editor displays a set of attributes (including suppressible) grouped under mb-static-subscription.
    4. image

    5. In the Property Editor, select true for the suppressible attribute. The JPD annotation in the source code is updated to include the suppressible attribute:
    6. @jpd:mb-static-subscription suppressible="true" 
      
  4. Design the business process to receive a message.
  5. Extract $metadata/property[name='GROUPID'] from the message into a variable (say, the myOrderNumber variable).
  6. Subscribe (dynamically) to the /my/orders channel using the myOrderNumber variable as a filter value. That is, use a filter expression with the same XPath expression as you used to extract the data into the variable in the preceding step:
  7. $metadata/property[name='GROUPID'] 
    

    To learn how to design a dynamic subscription, see Message Broker Subscription Control.

  8. Design a loop to receive the remainder of the messages with the same GROUPID using the subscription control.
  9. To learn how to design looping logic, see Looping Through Items in a List.

Note: To avoid race conditions, steps 1-5 must be performed while in a synchronous message broker subscription. To learn about creating a synchronous subscription, see Subscription Start (Synchronous).

Setting up the Event Generators

For the suppressible pattern in this example to work correctly, there must be a single publisher for a given group ID. Having a single publisher for the group ID means that the publisher is paused when a new subscriber is subscribing dynamically (see steps 1-5 in the preceding section: Setting up the Business Process), thereby avoiding race conditions with the subscriptions. When you use JMS event generators, there are two ways to ensure that a single publisher publishes a given group ID:

Previous Document