Now that we have our client, we want to start writing messages to a topic on our cluster. This is completed by creating a producer from our client.
Creation of a producer:
- Create an Apache Pulsar Client
- Producer attaches to a topic
- Producer does a lookup to determine which broker is assigned to it
- Producer publishes messages to broker for processing
- The broker returns a message acknowledging the send succeeded
Key features of a producer:
- Many producers can (and should) share a client
- Producers must have a unique name
- Producers have an internal message buffer allowing for:
- Transparently handle topics being moved to different brokers
- Resend messages that fail
- Ensure local message ordering
- Ensure messages are published in order to the broker
- Enable performance improvements through batching
- Producers are designed to easily provide “at-least-once” message delivery
- Messages are not removed from the local queue until they have been acknowledged by the broker