I want to setup integration of ServiceNow instance with Apache Kafka. Please provide some help.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2025 01:04 AM
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Integration Options
1. Kafka REST Proxy Method
Use Kafka REST Proxy v3 API for HTTP/JSON communication
ServiceNow Business Rule:
(function executeRule(current, previous) {
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('http://kafka-proxy:8082/v3/clusters/CLUSTER_ID/topics/servicenow-events/records');
request.setHttpMethod('POST');
request.setRequestHeader('Content-Type', 'application/json');
var payload = {
"value": {
"table": current.getTableName(),
"sys_id": current.sys_id.toString(),
"action": current.isNewRecord() ? 'insert' : 'update'
}
};
request.setRequestBody(JSON.stringify(payload));
var response = request.execute();
})(current, previous);
2. Scripted REST API Method
Create custom ServiceNow endpoints for Kafka to consume
Create Scripted REST API:
(function process(request, response) {
var requestBody = request.body.dataStream;
var kafkaData = JSON.parse(requestBody);
var gr = new GlideRecord('incident');
if (gr.get(kafkaData.sys_id)) {
gr.setValue('state', kafkaData.state);
gr.update();
response.setStatus(200);
response.setBody('Record updated');
}
})(request, response);
3. MID Server Integration
Use MID Server for secure on-premises Kafka connectivity
Install Kafka Java client on MID Server and create probe/sensor scripts.
Authentication & Security
ServiceNow supports OAuth 2.0, Basic Auth, and mTLS Kafka REST requires OAuth tokens for secure access
OAuth Setup:
Create Application Registry in ServiceNow
Configure OAuth endpoints
Use Bearer tokens in API calls
Best Practices
Implement rate limiting and error handling Use appropriate content types (application/json)
Rate Limiting: Configure ServiceNow API rate limits
Error Handling: Implement retry logic and dead letter queues
Monitoring: Use ServiceNow logs and Kafka metrics
Security: Enable HTTPS and proper authentication
Sample Integration Flow
ServiceNow Business Rule → Kafka REST Proxy
Kafka Consumer → ServiceNow Scripted REST API
Data transformation via ServiceNow Transform Maps
This approach leverages both platforms' native REST capabilities without complex middleware.
Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****