The Producer API provides methods that enable you to push data from a ServiceNow instance to a Kafka topic.

Note: This API is deprecated and replaced by the ProducerV2 - Scoped API.

This API requires the ServiceNow Integration Hub Action Step - Kafka Producer plugin (com.glide.hub.action_step.kafka) and is provided within the sn_ih_kafka namespace.

Producer - send(String topic, String key, String message, Boolean isSync)

Sends the specified message to the specified Kafka topic.

Table 2. Returns
Type Description
None

Example

This example shows how to send changed incident information to the changed_incidents Kafka topic.

var message = {
  'number': current.number.toString(),
  'short_description': current.short_description.toString(),
  'caller_id': current.caller_id.getDisplayValue(),
  'priority': current.priority.toString(),
  'state': current.state.toString()
};

var producer = new sn_ih_kafka.Producer();
producer.send('changed_incidents', current.number.toString(), JSON.stringify(message), false);