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 Details

    • HttpSink

      public HttpSink()
  • Method Details

    • open

      public void open(Map<String,Object> config, SinkContext sinkContext) throws Exception
      Specified by:
      open in interface Sink<org.apache.pulsar.client.api.schema.GenericObject>
      Throws:
      Exception
    • write

      public void write(org.apache.pulsar.functions.api.Record<org.apache.pulsar.client.api.schema.GenericObject> record) throws Exception
      Specified by:
      write in interface Sink<org.apache.pulsar.client.api.schema.GenericObject>
      Throws:
      Exception
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable