Apache Pulsar http bridge gives a simple api to produce messages to multiple topics with single transaction .
Following environment variables can be set to configure .
VARIABLE | DESCRIPTION |
---|---|
PORT | Server port to listen |
DISABLE_PULSAR_LOGS | Disable logging for pulsar client if set to "yes" |
LOG_LEVEL | zerolog Log levels |
PULSAR_CLIENT_TIMEOUT_SEC | Timeout for pulsar client |
PULSAR_OPERATION_TIMEOUT_SEC | pulsar publisher execution timeout |
PULSAR_BROKERS | List of pulsar brokers comma seperated e.g: ip:port[,ip:port] |
TNX_TIMEOUT_SEC | Transaction timeout |
MAX_PENDING_MSGS | Max queue size for publisher |
BATCHING_MAX_SIZE | Max bytes permitted in a batch |
~$ git clone [email protected]:arslanmughal99/pulsar-bridge.git PulsarBridge
~$ cd PulsarBridge
~$ go run .
server will start listening on configured port exposing /produce
endpoint .
curl --location 'localhost:3000/produce' --header 'Content-Type: application/json' --data '{
"data": [
{
"topic": "topic-1",
"messages": [
"Test data 1",
"Test data 2",
...
]
},
{
"topic": "topic-2",
"messages": [
"Test data 1",
"Test data 2",
...
]
}
]
}'
{
"total": 4
}