Skip to main content
Ctrl+K
PyFlink 1.20+vvr.11.7.dev0 documentation - Home PyFlink 1.20+vvr.11.7.dev0 documentation - Home
  • API Reference
  • Examples
  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataStream
    • StreamExecutionEnvironment
    • DataStream
    • Functions
    • State
    • Timer
    • Window
    • Checkpoint
    • Side Outputs
    • Asynchronous I/O
    • Connectors
    • Formats
  • PyFlink DataFrame
  • PyFlink Common
  • API Reference
  • PyFlink DataStream
  • Connectors
  • pyflink.datastream.connectors.pulsar.PulsarSinkBuilder

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(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(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_authentication(auth_plugin_class_name, ...)

Configure the authentication provider to use in the Pulsar client instance.

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(serialization_schema)

Sets the SerializationSchema of the PulsarSinkBuilder.

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

This Page

  • Show Source

Created using Sphinx 7.4.7.

Built with the PyData Sphinx Theme 0.16.1.