Success and Failure Listeners (Callback Functions)
For each instantiated and deployed pattern instance, you configure two callback rule functions. One acts as a success listener and the other as a failure listener.
The listeners execute every time a pattern succeeds or fails.
On successful completion of a pattern the service invokes the success listener. If the pattern fails because of a timeout or elements of the pattern arriving out of order, then it invokes the failure listener.
Success and failure listeners have the same arguments. Advanced listeners have an additional argument.
Functions that Cannot be Used in Listeners
Functions that read, modify, or delete concepts and events, such as Instance.deleteInstance(), cannot be used in the callback functions that you use as listeners. These functions must execute in the context of a run to completion cycle (RTC). They cannot be used in success or failure listeners, which run in a different thread. (See the functions documentation for details on thread pool management functions such as the Pattern.Manager.Advanced.setPoolSize() function.)
In order to use functions that execute in the context of an RTC, create a rule that executes the functions, and create an event with all the necessary information. Send the event using Pattern.IO.toDestination(), preferably on a local channel. The event is asserted in an RTC and triggers the rule, which executes the desired functions.
- Function Documentation
For all function documentation, see the tooltips in the function catalog view in TIBCO BusinessEvents Studio. Tooltip text is also available in the online references available in the HTML documentation. Expand to CEP Pattern > Pattern in the function catalog. - Advanced Listeners
Advanced listeners (callback functions) can provide some insight into the events that triggered the pattern. Advanced listeners have an opaque object but otherwise the signature is the same as the simple listener. - Listener Required Signature
Simple listeners (callback functions) must have a signature with the parameter types except the opaque parameter. The advanced listener also uses the opaque parameter.