Chapter 2 Working With Channels and Destinations : Working With Channels and Destinations

Working With Channels and Destinations
The procedure for creating channels and destinations is the same, though the configuration options are different.
Creating a Channel
1.
Open the folder in which you want to store the channel, right-click in the design panel, and select Add Resource > BusinessEvents Workbench > Channel.
2.
3.
4.
For JMS and Rendezvous channels: From the Method of Configuration drop-down list, select one of the following:
Resource Select Resource if you have a shared resource in your project whose properties you want to reuse for this channel.
Properties Select Properties to configure this channel resource using properties. See Channel Resource Reference for details.
Resource names and directory names  The path to the resource and the resource name cannot contain any of the keywords or other reserved words listed in the TIBCO BusinessEvents Language Reference, and they cannot use spaces.
5.
Click Apply and save the project.
Creating a JMS or Rendezvous Destination
1.
Open the channel in which you want to create the destination, right-click in the design panel, and select Add Resource > BusinessEvents Workbench > Destination.
2.
Default Event
3.
In the Default Event field, browse to and select the event to be created (by default) from incoming messages received by this destination.
4.
5.
6.
Click Apply and save the project.
Reconnecting to a JMS Server
The following engine properties enable you to define how BusinessEvents attempts to reconnect to a JMS server in the event of a disconnection.
Specifies the number of reconnection attempts, and the interval between each attempt to connect to the JMS server.
The value must use the format: attempts, retry interval. For example: 10,500 means 10 attempts, with a 500 millisecond interval between each retry attempt.
Note: Use either be.jms.reconnect.timeout or com.tibco.tibjms.connect.attempts. If you set both the properties, then com.tibco.tibjms.connect.attempts takes precedence.
A value of 0 (zero) means don’t retry. Any other value means keep retrying (with no limit to number of retries), and use the specified interval between each attempt.
Note: Unacknowledged messages (Events) are resent to the BusinessEvents engine, which may result in duplicate events.
Note: Use either be.jms.reconnect.timeout or com.tibco.tibjms.connect.attempts. If you set both the properties, then com.tibco.tibjms.connect.attempts takes precedence.
Specifies a case-insensitive character pattern that matches all error messages or error codes that will cause a reconnect attempt.
Creating a Local Destination
1.
Open the local channel in which you want to create the destination, right-click in the design panel, and select Add Resource > BusinessEvents Workbench > Destination.
2.
3.
4.
Click Apply and save the project.
Using a Local Destination in a Rule
Local destinations are used in rules to route events to an appropriate rule session.
Various criteria may determine which rule session is appropriate for an event, depending on the way the project is configured. In the example provided (BE_HOME/Examples/MultipleSessionsAndLocalChannel) large orders are routed to one rule session and small orders to another.
To route an event to a local channel, use the Event.routeTo() function. You can use this function for other purposes too.
In the provided example, events containing small orders are sent to the rule session that deals with small orders as follows:
Event.routeTo(order, "/Channels/Local/toSmall", "");
The signature of this function is as follows:
SimpleEvent routeTo(SimpleEvent event, String destinationPath, String properties)
See TIBCO BusinessEvents Language Reference and TIBCO BusinessEvents Functions Reference for more details on functions.