Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataStream
    • StreamExecutionEnvironment
    • DataStream
    • Functions
    • State
    • Timer
    • Window
    • Checkpoint
    • Side Outputs
    • Connectors
    • Formats
  • PyFlink Common

pyflink.datastream.connectors.pulsar.PulsarSinkBuilder#

class PulsarSinkBuilder[source]#

The builder class for PulsarSink to make it easier for the users to construct a PulsarSink.

The following example shows the minimum setup to create a PulsarSink that reads the String values from a Pulsar topic.

Example:

>>> sink = PulsarSink.builder() \
...     .set_service_url(PULSAR_BROKER_URL) \
...     .set_admin_url(PULSAR_BROKER_HTTP_URL) \
...     .set_topics([TOPIC1, TOPIC2]) \
...     .set_serialization_schema(
...         PulsarSerializationSchema.flink_schema(SimpleStringSchema())) \
...     .build()

The service url, admin url, and the record serializer are required fields that must be set. If you don’t set the topics, make sure you have provided a custom TopicRouter. Otherwise, you must provide the topics to produce.

To specify the delivery guarantees of PulsarSink, one can call #setDeliveryGuarantee(DeliveryGuarantee). The default value of the delivery guarantee is DeliveryGuarantee#NONE, and it wouldn’t promise the consistence when write the message into Pulsar.

Example:

>>> sink = PulsarSink.builder() \
...     .set_service_url(PULSAR_BROKER_URL) \
...     .set_admin_url(PULSAR_BROKER_HTTP_URL) \
...     .set_topics([TOPIC1, TOPIC2]) \
...     .set_serialization_schema(
...         PulsarSerializationSchema.flink_schema(SimpleStringSchema())) \
...     .set_delivery_guarantee(DeliveryGuarantee.EXACTLY_ONCE)
...     .build()

Methods

build()

Build the PulsarSink.

delay_sending_message(message_delayer)

Set a message delayer for enable Pulsar message delay delivery.

set_admin_url(admin_url)

Sets the admin endpoint for the PulsarAdmin of the PulsarSink.

set_config(key, value)

Set an arbitrary property for the PulsarSink and Pulsar Producer.

set_delivery_guarantee(delivery_guarantee)

Sets the wanted the DeliveryGuarantee.

set_producer_name(producer_name)

The producer name is informative, and it can be used to identify a particular producer instance from the topic stats.

set_properties(config)

Set an arbitrary property for the PulsarSink and Pulsar Producer.

set_serialization_schema(...)

Sets the PulsarSerializationSchema that transforms incoming records to bytes.

set_service_url(service_url)

Sets the server's link for the PulsarProducer of the PulsarSink.

set_topic_router(topic_router_class_name)

Use a custom topic router instead predefine topic routing.

set_topic_routing_mode(topic_routing_mode)

Set a routing mode for choosing right topic partition to send messages.

set_topics(topics)

Set a pulsar topic list for flink sink.

previous

pyflink.datastream.connectors.pulsar.PulsarSink

next

pyflink.datastream.connectors.jdbc.JdbcSink

On this page
  • PulsarSinkBuilder
Show Source

Created using Sphinx 5.3.0.