---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ProducerV2 - Scoped

# ProducerV2 - Scoped {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The ProducerV2 API provides methods to publish messages from your
ServiceNow instance to a Kafka topic.  
Note:  
This API requires a Stream Connect subscription. For more information, see <https://www.servicenow.com/products/automation-engine.html>.
This API requires the ServiceNow Stream Connect Installer plugin (com.glide.hub.stream_connect.installer) and runs in the `sn_ih_kafka` namespace.

## ProducerV2 - send(String topicSysID, String key, String message, Boolean isSync, Object headers, String schemaID) {#ariaid-title2}

Sends the specified message to the specified Kafka topic.
{#ProducerV2-send-S_S_S_B_O__table_vn5_c3f_nvb__entry__3}

| Name | Type | Description |
|-|-|-|
| topicSysID | String | Sys_id of the topic to publish the message to. Topics are stored in the Kafka Topics \[sys_kafka_topic\] table. |
| key | String | Name of the key for a specific partition in the topic. |
| message | String | Message text. |
| isSync | Boolean | Flag that indicates whether to require the script to wait for the send method to complete before continuing. Valid values: * true: Wait for the step to complete before continuing the associated flow. * false: Do not wait for the step to complete before continuing the associated flow. |
| headers | Object | Headers for the message, defined as key-value pairs. "headers": { "<key>": "<value>" } For example, `var headers = { "origin": "sn_business_rule" };` * `key`: String. Name of the header. * `value`: String. Value of the header. |
| schemaID | String | Sys_id of the schema record. Required if you're using a schema to convert plain-text messages to Avro messages and back. Schemas are stored in the Stream Connect Schemas \[stream_connect_schema\] table. For more information, see [Schema management in Stream Connect](https://www.servicenow.com/docs/access?context=schema-management&version=xanadu&pubname=xanadu-integrate-applications&ft:locale=en-US). |
[Table 1. Parameters]

{#ProducerV2-send-S_S_S_B_O__table_vn5_c3f_nvb} {#ProducerV2-send-S_S_S_B_O__table_wn5_c3f_nvb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#ProducerV2-send-S_S_S_B_O__table_wn5_c3f_nvb}  
This example shows how to send changed incident information to the Kafka topic with a sys_id of 75135aa2ff0311105cf343d0653bf155, using a schema with a sys_id of f9d083f3ff610210ef7343d3653bf12e.

    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 headers = {
        'origin': 'sn_business_rule'
    };

    var producer = new sn_ih_kafka.ProducerV2();
    producer.send('75135aa2ff0311105cf343d0653bf155', gs.generateGUID(), JSON.stringify(message), false, headers, 'f9d083f3ff610210ef7343d3653bf12e');


