Package org.apache.pulsar.io.http
Class HttpSink
java.lang.Object
org.apache.pulsar.io.http.HttpSink
- All Implemented Interfaces:
AutoCloseable,Sink<org.apache.pulsar.client.api.schema.GenericObject>
public class HttpSink
extends Object
implements Sink<org.apache.pulsar.client.api.schema.GenericObject>
A Sink that makes a POST request to a configured HTTP endpoint for each record (webhook).
The body of the HTTP request is the JSON representation of the record value.
Some headers are added to the HTTP request:
- PulsarTopic: the topic of the record
- PulsarKey: the key of the record
- PulsarEventTime: the event time of the record
- PulsarPublishTime: the publish time of the record
- PulsarMessageId: the ID of the message contained in the record
- PulsarProperties-*: each record property is passed with the property name prefixed by PulsarProperties-
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
HttpSink
public HttpSink()
-
-
Method Details
-
open
-
write
public void write(org.apache.pulsar.functions.api.Record<org.apache.pulsar.client.api.schema.GenericObject> record) throws Exception -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-