Pulsar
eventmesh-connector-pulsar is a source and sink connector. The source consumes messages from a Pulsar topic and publishes them to EventMesh. The sink takes events from EventMesh and produces them to Pulsar.
PulsarSinkConnector: From EventMesh to Pulsar
- Start Pulsar and EventMesh Runtime.
- Enable sinkConnector (
sinkEnable: trueinserver-config.yml) and checksink-config.yml. - Start
PulsarConnectServer. It subscribes topubSubConfig.subjectin EventMesh Runtime and publishes each record toconnectorConfig.topicin Pulsar. - Send a message to EventMesh on that subject; it appears on the Pulsar topic.
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: pulsarSink
appId: 5031
userName: pulsarSinkUser
passWord: pulsarPassWord
connectorConfig:
connectorName: pulsarSink
serviceUrl: 127.0.0.1:6650
topic: TopicTest
PulsarSourceConnector: From Pulsar to EventMesh
- Start Pulsar and EventMesh Runtime.
- Enable sourceConnector (
sourceEnable: trueinserver-config.yml) and checksource-config.yml. - Start
PulsarConnectServer. It subscribes to PulsarconnectorConfig.topicwith subscription namepubSubConfig.groupand sends each message topubSubConfig.subjectin EventMesh Runtime. - Send a message to that Pulsar topic; it appears in EventMesh.
pubSubConfig:
meshAddress: 127.0.0.1:10000
subject: TopicTest
idc: FT
env: PRD
group: pulsarSource
appId: 5032
userName: pulsarSourceUser
passWord: pulsarPassWord
connectorConfig:
connectorName: pulsarSource
serviceUrl: 127.0.0.1:6650
topic: TopicTest
Configuration
pubSubConfig is the EventMesh TCP client used to publish into or subscribe from Runtime. connectorConfig fields:
connectorName: name of the connector.serviceUrl: Pulsar broker address passed toPulsarClient.builder().serviceUrl().topic: Pulsar topic to produce (sink) or consume (source).
The source subscription name is pubSubConfig.group.
Precautions
- Bundled
server-config.ymlsetssourceEnable: trueandsinkEnable: true. Turn off the side you are not running. - Create the Pulsar topic first, or enable auto-topic creation on the broker.
serviceUrlis the Pulsar binary protocol address (commonlypulsar://host:6650). The sample uses127.0.0.1:6650.- This connector does not set token or TLS auth. The broker must accept an unauthenticated client.
- Source
pollusesconsumer.batchReceive()and acknowledges the batch after building records. - Sink
putsends each record as a Pulsar message. CloudEvent extensions become message properties.