Streaming Business Rule Based Message Processor Binds

Kafka Streaming Receiver IIEPs can use the 'STEP Streaming Business Action Message Processor' to log, return, and take action on data in the streaming messages. Refer to the IIEP - Configure STEP Streaming Business Action Message Processor Processing Engine topic in the Data Exchange documentation.

The bind can be found within the 'Binds to' dropdown, as shown below.

Configuration

To use any bind:

  1. Create a business rule as defined in the Creating a Business Rule, Function, or Library topic.

  2. Edit the business rule as defined in the Editing a Business Rule or Function topic.

  3. In the Edit Operation dialog, add the bind to a business rule, as defined in the Adding a Bind topic in the Resource Materials online help documentation.

  4. In the Edit Operation dialog, optionally add Messages, as defined in the Localized Messages for JavaScript Business Rules topic.

  5. In the Edit Operation dialog, add JavaScript to call the bind.

Example

The following is an example JavaScript that uses these binds.

Important: Example scripts should not be used as-is without thorough testing, including updating the script to match object and link types that exist on your system. JavaScript variable names are case-sensitive.

The streaming binds are:

  • The Streaming Message bind gives access to all data and metadata in the streaming message: key, topic, partition, offset, headers.

  • The Streaming Execution Report Logger bind writes to the IIEP execution log.

    • logInfo and logWarning writes to the message-streaming.log.

    • logError writes to the message-streaming.log and also writes to the Execution Report displayed in the workbench.

    For other logging options, refer to the standard logger as defined in the Logger Bind topic.

Copy
logger.logError("Message = " + new java.lang.String(message.content()));
logger.logError("Key = " + message.metadata().key());
logger.logError("Topic = " + message.metadata().topic());
logger.logError("Partition = " + message.metadata().partition());
logger.logError("Offset = " + message.metadata().offset());
logger.logError("Headers = " + message.metadata().headers());
var iterator = message.metadata().headers().iterator();
while (iterator.hasNext()) {
   var header = iterator.next();
   logger.logInfo("Header key = " + new java.lang.String(header.key()) + ", value = " + new java.lang.String(header.value()));
}