Channels and Destinations : Working with Local Channels

Working with Local Channels
Local channels are used in rules or rule functions to route events to an appropriate agent running in the same engine (processing unit). In multi-engine applications, local channels are generally replaced by the use of shared cached concepts. Local channels are useful in two cases:
For certain scenarios where an inference agent is co-deployed with a query agent. See TIBCO BusinessEvents Event Stream Processing Query Developer’s Guide.
See Adding Channels and Destinations for details on adding local channels.
Event Use Count
Local channels pass the same event object between the agents. Consuming the event in one agent does not affect other agents that also received the event over a local channel. A use count is maintained for each event to track how many agents have received the event but not consumed it. The use count of the event is incremented depending on the number of agents it is routed to. When an event is consumed in one agent, BusinessEvents deletes the reference to the event in that agent and it decrements the use count of the original event instance.
Using a Local Channel
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, BE_HOME/Examples/MultipleSessionsAndLocalChannel, events containing small orders are sent to the agent 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)