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.