Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Expand
titleContents

Table of Contents
stylenone
indent15px
stylenone

This component is used for executing JavaScript. The JavaScript to be executed is specified using the Custom Property Sheet (CPS). This component executes the script on documents it receives as input and returns the result.

Note
  • The component uses the document object to get the content and properties of the message. The result after executing of the script should be set back onto the document object.
  • The component uses "bsf" API to evaluate the script.

...

  • Input message content and properties can be accessed using document object. For example, 'document.getText()' returns input message content. To access a message property named 'TestProperty, 'document.getRecord().getProperty('TestProperty')' returns the value of the property.
  • All the Properties can be accessed using document.getRecord().getProperty('PropertyName').
  • Message properties can be set using 'document.getRecord().setProperty(String name, Object value)' method.
  • Message properties which are set on input message also appear on output message unless they are changed in the script. For example, if a property named 'TestProperty' is present on input message then output message also contains the property unless it is changed in script provided.
  • Output message content can be set either by using 'document.setText(String value)' of document object.
  • In message properties, property with name 'ESBX__SYSTEM__CARRY_FORWARD_CONTEXT' contains application context object.
    • Application context schema can be accessed using document.getRecord().getProperty("ESBX__SYSTEM__CARRY_FORWARD_CONTEXT").getAppContext() method.
    • Similarly, setAppContext(String appContext) can be used to modify application context.
  • JMS Correlation ID can be accessed/set using document.getRecord().getJMSCorrelationID() and document.getRecord().setJMSCorrelationID(String correlationID) methods.

Anchor
_Toc372741081
_Toc372741081
Configuration and Testing

...

Anchor
_Toc372741086
_Toc372741086
Useful Tips

The component uses the document object to get the content and properties of the message. The result after executing of the script should be set back onto the document object.

 

  • In message properties, property with name "ESBX__SYSTEM__CARRY_FORWARD_CONTEXT" contains application context object.
    • Application context schema can be accessed using document.getRecord().getProperty("ESBX__SYSTEM__CARRY_FORWARD_CONTEXT").getAppContext().
    • Similarly setAppContext(String appContext) can be used to modify application context.
Adaptavist ThemeBuilder EngineAtlassian Confluence