Iam following this link https://docs.confluent.io/kafka-connect-http/current/index.html#http-connector-header-forwarding
this is the project file , im using https://github.com/confluentinc/kafka-connect-http-demo
I have done configuring everything, but I could not able to send requested body to the URL which was hosted by Node/Python.
Could someone suggest any changes in configuration.
{
"name": "test1",
"config":
{
"topics": "kafka-data",
"request.method": "POST",
"tasks.max": "1",
"connector.class": "io.confluent.connect.http.HttpSinkConnector",
"http.api.url": "http://localhost:3000/api/messages",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.storage.StringConverter",
"confluent.topic.bootstrap.servers": "localhost:9092",
"confluent.topic.replication.factor": "1",
"reporter.bootstrap.servers": "localhost:9092",
"reporter.result.topic.name": "success-responses",
"reporter.result.topic.replication.factor": "1",
"reporter.error.topic.name":"error-responses",
"reporter.error.topic.replication.factor":"1"
}
}
URL was hosted using Node.
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
const port = 3000
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
let tempContainer = [];
app.get('/api/messages', (req, res) => {
res.send({ 'all watchers': tempContainer })
})
app.post('/api/messages', (req, res) => {
console.log('your req.body:', req.body);
req.body.id = 'randumId_' + Math.floor(Math.random() * 10)
tempContainer.push(req.body)
res.send({ 'watchers log updated': req.body })
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
this is my node code Thanks in advance.