The JavaScript filter executes the script to process messages as they pass through the Rhapsody engine.
The JavaScript filter is a general purpose filter that runs JavaScript to perform actions on messages. Because it is a scripting language, it has the ability to perform complex tasks for manipulation or calculation. The filter supports standard JavaScript, and Rhapsody includes a number of additions to access information in the messages, message properties and log files.
This filter adds three global objects to the core JavaScript language:
input
- an array of ROMessage (Read-only Message) objects providing access to the input messages for the filter. Refer to ROMessage Object for details.output
- a MessageCollection object that allows you to append messages to the collection using another message as a template. Refer to MessageCollection Object for details.log
- an object that provides access to the Rhapsody logging system. Refer to Log Object for details.
The JavaScript filter supports JavaScript Regular Expressions.
When a JavaScript filter is first created, it is configured with a sample script:
- Refer to JavaScript Object Reference for details on JavaScript objects and their properties and methods.
- Refer to Shared JavaScript Libraries for details on how to manage shared JavaScript libraries.
- Refer to Using the JavaScript Filter for examples on how to use the JavaScript filter.
If you are processing JSON messages, use the JSON object.