# exportViaKafka

A Workflow Engine function that exports the payload from a createPayload function to an external Kafka endpoint.

To use this function, you must first configure the following:

• A Kafka Endpoints integration, which configures the endpoints for this function to use.

• A createPayload function which precedes this function, in order to generate the payloads this function exports.

• For best practice, create a new engine to handle the data export process. This is to prevent potential blockages during the export process under load.

If you want to export both alerts and Situations, you must create a separate engine for each workflow. A separate engine has the following moolet characteristics:

standalone_moolet: true
event_handlers: [<if required>]
process_output_of: <place in the moolet chain>

Moogsoft recommends this moolet is single threaded to ensure Moogsoft Enterprise works at the same rate as the receiving API. However, you can modify the thread count if necessary, for example if the endpoint has inherent rate or load mechanics, or ordering. No other moolet should rely on or process the output of this one.

This function is available as a feature of the Workflow Engine v1.2 download and later.

This function is available for alert, enrichment, and Situation workflows.

The workflow sweep up filter applies to this function. If you use the sweep up filter within the workflow, createPayload applies to all the objects in the workflow. Consequently, exportViaKafka exports the payload created using all objects within the workflow.

## Arguments

Workflow Engine function exportViaKafka takes the following arguments:

Name

Required

Type

Description

endpointName

Yes

String

Name of the Kafka endpoint defined in the Kafka Endpoints Reference integration.

topic

Yes

String

Destination Kafka topic.

key

No

String

Optional Kafka topic key. Allows substitution such as '\$custom_info.myvalue'.

## Example

The following example demonstrates typical use of Workflow Engine function exportViaKafka.

If you want to export to an endpoint with the name Broker1, set the following:

• endpointName: AlertExport

• topic: Export Feed

• key: myKey

The UI translates your settings to the following JSON:

{"endpointName":"AlertExport","topic":"myTopic","key":"myKey"}

The function returns true if it was able to locate and successfully complete the export. If it could not find the endpoint configuration, or the export was unsuccessful, the function returns false.