ServiceNow Source V2 Connector for Confluent Cloud

The fully-managed ServiceNow Source V2 connector for Confluent Cloud is used to poll data from the specified ServiceNow tables and get these changes into Apache Kafka® in real time. The connector supports Avro, JSON Schema, and Protobuf data output formats for Kafka topics. The connector consumes data from up to five ServiceNow tables to add records in Kafka topics.

If you require private networking for fully-managed connectors, make sure to set up the proper networking beforehand. For more information, see Manage Networking for Confluent Cloud Connectors.

Features

The ServiceNow Source V2 connector includes the following features:

  • Topics created automatically: The connector can automatically create Kafka topics.

  • Secure access and data exchange: The connector supports the following authentication mechanisms:

    • Basic
    • OAuth2 client credentials
  • API error reporting management: You can configure the connector to notify you when an API error occurs through email or the Confluent Cloud Console. You can also configure the connector to ignore when an API error occurs.

  • Supported data formats: The connector supports Avro, JSON Schema, and Protobuf data formats. Schema Registry must be enabled to use a Schema Registry-based format. For additional information, see Schema Registry Enabled Environments.

  • At least once delivery: The connector guarantees that records are delivered at least once to the Kafka topic.

  • Multiple tables support: The connector allows you to fetch records from up to five tables simultaneously. This is supported with multiple tasks also.

  • Elasticity: The connector allows you to configure two parameters that enforce the throughput limit: table{{i}}.batch.size and table{{i}}.request.interval.ms. The connector defaults to 20000 records and a 2000 milliseconds polling interval. If a large number of updates occur within the given interval, the connector will paginate records according to configurable batch size. Note that because ServiceNow provides precision to one second, the ServiceNow V2 connector sets 2000 milliseconds as the lowest table{{i}}.request.interval.ms configuration property setting.

  • Schema registry and schema context support: The connector allows you to map an API to a specific schema context so that you can use the schema context feature in different environments.

  • Custom offset support: The connector allows you to configure custom offsets using the Confluent Cloud Console to prevent data loss and data duplication.

  • Configurable retry functionality: The connector allows you to customize retry settings based on your requirements.

  • New configuration support: The connector supports the following new property configurations:

    • Specify initial timestamps up to granularity of seconds.
    • Specify table{{i}}.pagination.query (equivalent to sysparm_query) to allow an encoded query to filter the result set. For pagination, use either sys_updated_on or sys_created_on.
    • Specify table{{i}}.display.value (equivalent to sysparm_display_value) to determine the type of data returned, either the actual values from the database or the display values of the fields.
    • Use table{{i}}.allowlisted.fields (equivalent to sysparm_fields) to specify the desired list (comma-separated) of fields from the table record for ingestion in Kafka.

    For more information about new properties, see ServiceNow Table API.

  • Client-side field level encryption (CSFLE) support: The connector supports CSFLE for sensitive data. For more information about CSFLE setup, see connector configuration.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Limitations

Be sure to review the following information:

Manage custom offsets

You can manage the offsets for this connector. Offsets provide information on the point in the system from which the connector is accessing data. For more information, see Manage Offsets for Fully-Managed Connectors in Confluent Cloud.

To manage offsets:

To get the current offset, make a GET request that specifies the environment, Kafka cluster, and connector name.

GET /connect/v1/environments/{environment_id}/clusters/{kafka_cluster_id}/connectors/{connector_name}/offsets
Host: https://api.confluent.cloud

Response:

Successful calls return HTTP 200 with a JSON payload that describes the offset.

{
    "id": "lcc-example123",
    "name": "{connector_name}",
     "offsets": [
        {
           "partition": {
              "url": "https://<servicenow-instance>.service-now.com/api/now/table/incident"
           },
           "offset": {
              "offset": "2024-12-16 14:25:58",
              "operator": "=",
              "primary_key": "ee3fb4c9c3ea12100127x"
           }
        }
     ],
    "metadata": {
        "observed_at": "2024-03-28T17:57:48.139635200Z"
    }
}

Responses include the following information:

  • The position of the latest offset.
  • The observed time of the offset in the metadata portion of the payload. The observed_at time indicates a snapshot in time for when the API retrieved the offset. A running connector continuously updates its offsets. Use observed_at to get a sense of the gap between real time and the time at which the request was made. By default, offsets are observed every minute. Calling GET repeatedly will fetch more recently observed offsets.
  • Information about the connector.

JSON payload

The table below provides a description of the unique fields in the JSON payload for managing offsets of the ServiceNow Source V2 connector.

Field Definition Required/Optional
url Combination of the ServiceNow base URL and the table API path. Required
offset Timestamp (yyyy-MM-dd HH:mm:ss) is used as the offset for all records. Required
operator Always set to >= Required
primary_key Always set as empty string - "" Required

Quick Start

Use this quick start to get up and running with the ServiceNow Source V2 connector on Confluent Cloud connector.

Prerequisites

Using the Confluent Cloud Console

Step 1: Launch your Confluent Cloud cluster

See the Quick Start for Confluent Cloud for installation instructions.

Step 2: Add a connector

In the left navigation menu, click Connectors. If you already have connectors in your cluster, click + Add connector.

Step 3: Select your connector

Click the ServiceNow Source V2 connector card.

ServiceNow Source V2 Connector Card

Step 4: Enter the connector details

Note

  • Ensure you have all your prerequisites completed.
  • An asterisk ( * ) designates a required entry.

At the Add ServiceNow Source V2 Connector screen, complete the following:

  1. Select the way you want to provide Kafka Cluster credentials. You can choose one of the following options:
    • My account: This setting allows your connector to globally access everything that you have access to. With a user account, the connector uses an API key and secret to access the Kafka cluster. This option is not recommended for production.
    • Service account: This setting limits the access for your connector by using a service account. This option is recommended for production.
    • Use an existing API key: This setting allows you to specify an API key and a secret pair. You can use an existing pair or create a new one. This method is not recommended for production environments.
  2. Click Continue.

Step 5: Check for records

Verify that records are being produced at the Kafka topic.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Using the Confluent CLI

To set up and run the connector using the Confluent CLI, complete the following steps, but ensure you have met all prerequisites.

Step 1: List the available connectors

Enter the following command to list available connectors:

confluent connect plugin list

Step 2: List the connector configuration properties

Enter the following command to show the connector configuration properties:

confluent connect plugin describe <connector-plugin-name>

The command output shows the required and optional configuration properties.

Step 3: Create the connector configuration file

Create a JSON file that contains the connector configuration properties. The following example shows the required connector properties.

{
  "connector.class": "ServiceNowSourceV2",
  "name": "ServiceNowSourceV2Connector_1",
  "kafka.auth.mode": "KAFKA_API_KEY",
  "kafka.api.key": "****************",
  "kafka.api.secret": "************************************************",
  "output.data.format": "JSON_SR",
  "tasks.max": "1",
  "servicenow.url": "https://instance.service-now.com",
  "auth.type": "BASIC",
  "connection.user": "admin",
  "connection.password": "************",
  "tables.num": "2",
  "table1.name": "incident",
  "table1.topic": "topic-1",
  "table1.batch.size": "20000",
  "table1.start.timestamp": "1970-01-01 00:00:00",
  "table1.timestamp.field": "sys_updated_on",
  "table1.display.value": "false",
  "table1.request.interval.ms": "2000",
  "table2.name": "perf_test",
  "table2.topic": "topic-2",
  "table2.batch.size": "20000",
  "table2.start.timestamp": "1970-01-01 00:00:00",
  "table2.timestamp.field": "sys_updated_on",
  "table2.display.value": "false",
  "table2.request.interval.ms": "2000"
}

Note the following property definitions:

  • "connector.class": Identifies the connector plugin name.
  • output.data.format": Enter an output data format (data going to the Kafka topic): AVRO, JSON_SR (JSON Schema), or PROTOBUF. Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON_SR (JSON Schema), or Protobuf). See Schema Registry Enabled Environments for additional information.
  • "kafka.auth.mode": Identifies the connector authentication mode you want to use. There are two options: SERVICE_ACCOUNT or KAFKA_API_KEY (the default). To use an API key and secret, specify the configuration properties kafka.api.key and kafka.api.secret, as shown in the example configuration (above). To use a service account, specify the Resource ID in the property kafka.service.account.id=<service-account-resource-ID>. To list the available service account resource IDs, use the following command:

    confluent iam service-account list
    

    For example:

    confluent iam service-account list
    
       Id     | Resource ID |       Name        |    Description
    +---------+-------------+-------------------+-------------------
       123456 | sa-l1r23m   | sa-1              | Service account 1
       789101 | sa-l4d56p   | sa-2              | Service account 2
    
  • "name": Sets a name for your new connector.

  • "table<i>.topic": Enter the topic name where data is sent.

  • "tasks.max": Enter the maximum number of tasks for the connector to use. More tasks might improve performance.

    Note

    The maximum number of tasks should be less than or equal to the number of tables configured.

  • "tables.num": Specify the number of tables to poll the data from. Note that this value should be less than or equal to 5. Configure the number of tables you set in the tables.num field. For example, if you entered 2 in the tables.num field, you should set 2 table configurations as shown in the connector properties example above. For more information about table properties and values, see Configuration Properties.

Single Message Transforms: For details about adding SMTs using the CLI, see the Single Message Transforms (SMT) documentation. For all property values and descriptions, see Configuration Properties.

Step 4: Load the properties file and create the connector

To load the configuration and start the connector, run the following Confluent CLI command:

confluent connect cluster create --config-file <file-name>.json

For example:

confluent connect cluster create --config-file servicenow-source-v2-config.json

Example output:

Created connector ServiceNowSourceV2Connector_0 lcc-do6vzd

Step 5: Check the connector status.

To check the connector status, run the following Confluent CLI command:

confluent connect cluster list

Example output:

ID           |             Name                           | Status  | Type | Trace |
+------------+--------------------------------------------+---------+------+-------+
lcc-do6vzd   | ServiceNowSourceV2Connector_0    | RUNNING | sink |       |

Step 6: Check for records

Verify that records are populating the endpoint.

For more information and examples to use with the Confluent Cloud API for Connect, see the Confluent Cloud API for Connect Usage Examples section.

Tip

When you launch a connector, a Dead Letter Queue topic is automatically created. See View Connector Dead Letter Queue Errors in Confluent Cloud for details.

Moving from V1 to V2

Use one of the following options to migrate to ServiceNow Source V2 connector. Implement and validate any connector changes in a pre-production environment before promoting to production.

Migration option 1

  1. Pause the ServiceNow Source V1 connector.
  2. Note the timestamp of the last sourced record.
  3. Create a ServiceNow Source V2 connector to fetch all records that were created or updated from that specific point in time by configuring table1.start.timestamp and table1.timestamp.field (to sys_updated_on) properties.
  4. Verify the records and confirm that the V2 connector is running successfully with the fetched records.
  5. Delete the V1 connector.

Migration option 2

  1. Pause the ServiceNow Source V1 connector.

  2. Get the offset for the V1 connector.

  3. Create a ServiceNow Source V2 connector using the offset from the previous step.

    confluent connect cluster create [flags]
    

    For example:

    Create a configuration file with connector configs and offsets.

    {
      "name": "(connector-name)",
      "config": {
          ... // connector specific configuration
      },
      "offsets": [
          {
              "partition": {
          ... // connector specific configuration
              },
              "offset": {
          ... // connector specific configuration
              }
          }
      ]
    }
    

    Create a V2 connector in the current or specified Kafka cluster context.

    confluent connect cluster create --config-file config.json
    

    Note

    The configuration payload differs between V1 and V2 connectors. In the V2 connector, the value field contains only the value of the key-value pair and does not include the key, topic, partition, and offset. Make necessary changes in the V2 connector to match the configurations from the V1 connector.

  4. Verify the migration and confirm that the V2 connector is running successfully with the V1 payloads.

  5. Set table1.start.timestamp and table1.timestamp.field to fetch all records that were created or updated from a specific point in time.

  6. Delete the V1 connector.

For more information, see Manage Offsets for Fully-Managed Connectors in Confluent Cloud.

Configuration Properties

Use the following configuration properties with the fully-managed ServiceNow Source V2 connector. The connector allows you to fetch records from up to five tables simultaneously. For example, if you enter 2 in the tables.num field, you should configure two tables using the Table-1 configurations section. For more information, see sample JSON file containing the table configuration properties.

How should we connect to your data?

name

Sets a name for your connector.

  • Type: string
  • Valid Values: A string at most 64 characters long
  • Importance: high

Kafka Cluster credentials

kafka.auth.mode

Kafka Authentication mode. It can be one of KAFKA_API_KEY or SERVICE_ACCOUNT. It defaults to KAFKA_API_KEY mode.

  • Type: string
  • Default: KAFKA_API_KEY
  • Valid Values: KAFKA_API_KEY, SERVICE_ACCOUNT
  • Importance: high
kafka.api.key

Kafka API Key. Required when kafka.auth.mode==KAFKA_API_KEY.

  • Type: password
  • Importance: high
kafka.service.account.id

The Service Account that will be used to generate the API keys to communicate with Kafka Cluster.

  • Type: string
  • Importance: high
kafka.api.secret

Secret associated with Kafka API key. Required when kafka.auth.mode==KAFKA_API_KEY.

  • Type: password
  • Importance: high

Schema Config

schema.context.name

Add a schema context name. A schema context represents an independent scope in Schema Registry. It is a separate sub-schema tied to topics in different Kafka clusters that share the same Schema Registry instance. If not used, the connector uses the default schema configured for Schema Registry in your Confluent Cloud environment.

  • Type: string
  • Default: default
  • Importance: medium
value.subject.name.strategy

The method to construct the subject name used to register the value schema with the Schema Registry. Valid values are TopicNameStrategy, RecordNameStrategy, or TopicRecordNameStrategy.

  • Type: string
  • Default: TopicNameStrategy
  • Valid Values: RecordNameStrategy, TopicNameStrategy, TopicRecordNameStrategy
  • Importance: medium

Output messages

output.data.format

Output Kafka record value format. Valid entries are AVRO, JSON_SR, or PROTOBUF. Ensure you configure the Confluent Cloud Schema Registry for such schema-based message formats.

  • Type: string
  • Default: JSON_SR
  • Importance: high
ignore.default.for.nullables

When set to true, this property ensures that the corresponding record in Kafka is NULL, instead of showing the default column value.

  • Type: boolean
  • Default: false
  • Importance: medium

Number of tasks for this connector

tasks.max

Maximum number of tasks for the connector.

  • Type: int
  • Valid Values: [1,…]
  • Importance: high

Behavior on error

behavior.on.error

The error handling behavior setting for handling error response from HTTP requests. Valid values are FAIL or IGNORE.

  • Type: string
  • Default: FAIL
  • Importance: low

Authentication

servicenow.url

ServiceNow instance URL. For example: https://${instance-id}.service-now.com/.

  • Type: string
  • Importance: high
auth.type

The authentication type of the endpoint. Valid values are BASIC or OAUTH2.

  • Type: string
  • Default: BASIC
  • Importance: high
connection.user

The username for an endpoint requiring basic authentication.

  • Type: string
  • Importance: medium
connection.password

The password for an endpoint requiring basic authentication.

  • Type: password
  • Importance: medium
oauth2.token.url

The URL for fetching OAuth2 token. Supported grant type is Client Credentials.

  • Type: string
  • Importance: medium
oauth2.client.id

The client ID for fetching the OAuth2 token.

  • Type: string
  • Importance: medium
oauth2.client.secret

The client secret for fetching the OAuth2 token.

  • Type: password
  • Importance: medium
oauth2.token.property

The name of the property that contains the OAuth2 token returned by the OAuth2 token URL (defaults to access_token).

  • Type: string
  • Default: access_token
  • Importance: medium
oauth2.client.scope

The scope parameter sent to the service when fetching the OAuth2 token.

  • Type: string
  • Default: any
  • Importance: medium
oauth2.client.auth.mode

The encoding method of the client_id and client_secret in an OAuth2 authorization request. If set to header, the credentials are encoded as an Authorization: Basic <base-64 encoded client_id:client_secret> HTTP header. If set to url, the credentials are sent as URL-encoded parameters.

  • Type: string
  • Default: header
  • Importance: medium
oauth2.client.headers

HTTP headers that should be included in the OAuth2 client endpoint. Individual headers must be separated by a |.

  • Type: password
  • Importance: low
servicenow.ssl.enabled

Determine whether the connection to the endpoint should use SSL.

  • Type: boolean
  • Default: false
  • Importance: medium
servicenow.ssl.keystorefile

The key store containing the server certificate.

  • Type: password
  • Importance: low
servicenow.ssl.keystore.password

The store password for the key store file.

  • Type: password
  • Importance: high
servicenow.ssl.key.password

The password for the private key in the key store file.

  • Type: password
  • Importance: high
servicenow.ssl.truststorefile

The trust store containing a server CA certificate.

  • Type: password
  • Importance: high
servicenow.ssl.truststore.password

The trust store password containing a server CA certificate.

  • Type: password
  • Importance: high
servicenow.ssl.protocol

The protocol to use for SSL connections.

  • Type: string
  • Default: TLSv1.3
  • Importance: medium

Tables

tables.num

The number of tables to fetch data from. This value should be less than or equal to 5.

  • Type: int
  • Default: 1
  • Valid Values: [1,…,5]
  • Importance: high

Retry configurations

retry.backoff.policy

The backoff policy to use for retry attempts. Valid values are CONSTANT_VALUE or EXPONENTIAL_WITH_JITTER.

  • Type: string
  • Default: EXPONENTIAL_WITH_JITTER
  • Importance: medium
retry.backoff.ms

The initial wait time in milliseconds after an error before a retry attempt is made. Subsequent backoff attempts can be a constant value or exponential with jitter (set via the retry.backoff.policy parameter). Jitter adds randomness to the exponential backoff algorithm to prevent synchronized retries.

  • Type: int
  • Default: 3000 (3 seconds)
  • Valid Values: [100,…]
  • Importance: medium
retry.on.status.codes

A comma-separated list of HTTP status codes or a range of codes to retry on. Ranges are specified with a starting code and an optional ending code. The range boundaries are inclusive. For instance, “400-” includes all codes greater than or equal to 400, and “400-500” includes codes from 400 to 500, including 500 itself. Multiple ranges and single codes can be combined for fine-grained control over retry behavior. For example, “404, 408, 500-” will retry on 404 NOT FOUND, 408 REQUEST TIMEOUT, and all 5xx error codes. Note that certain status codes, such as unauthorized, timeouts, and too many requests, will always prompt a retry.

  • Type: string
  • Default: 400-
  • Importance: medium
max.retries

The maximum number of retries on errors before a task is failed.

  • Type: int
  • Default: 3
  • Importance: medium

Table - 1 configurations

table1.name

The table name, combined with the ServiceNow Instance URL, will form the complete HTTP(S) URL. This path can be templated to include offset information.

  • Type: string
  • Default: “”
  • Importance: high
table1.topic

Specify the topic to which data will be pushed for this table.

  • Type: string
  • Default: “”
  • Importance: high
table1.batch.size

Size of the batch of records to be fetched from the ServiceNow table. Note that Basic and Standard Clusters may experience throughput limitations, even with a higher batch size.

  • Type: int
  • Default: 20000
  • Valid Values: [1,…,50000]
  • Importance: medium
table1.start.timestamp

Time to start fetching all updates/creation. Defaults to 1970-01-01 00:00:00. Note that the time is in UTC and requires format: yyyy-MM-dd HH:mm:ss.

  • Type: string
  • Default: 1970-01-01 00:00:00
  • Importance: medium
table1.timestamp.field

Timestamp Field to be used for pagination.

  • Type: string
  • Default: sys_updated_on
  • Importance: medium
table1.pagination.query

The query to be used for pagination on the table can be templated with offset information - ${offset}. Note that all other table-related configurations will be ignored if this is configured. It defaults to a timestamp-based pagination query. An example query is closed_at>=${offset}^ORDERBYclosed_at, where ${offset} refers to the pagination query offset field - closed_at.

  • Type: string
  • Default: “”
  • Importance: low
table1.pagination.query.field

Offset field if pagination query is used.

  • Type: string
  • Default: “”
  • Importance: low
table1.display.value

Specify whether to display values for the ServiceNow table records.

  • Type: boolean
  • Default: false
  • Importance: low
table1.allowlisted.fields

A comma-separated list of fields that should be included in the Kafka record. The list must necessarily include the selected timestamp field (either sys_updated_on or sys_created_on) and the sys_id field. It defaults to all fields from the response.

  • Type: string
  • Default: “”
  • Importance: low
table1.request.interval.ms

The time in milliseconds to wait between consecutive requests.

  • Type: int
  • Default: 2000 (2 seconds)
  • Valid Values: [2000,…]
  • Importance: medium

Next Steps

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL Demo. This example also shows how to use Confluent CLI to manage your resources in Confluent Cloud.

../_images/topology.png