Chapter 6. Producers

In Chapter 5, we discussed the philosophy of consuming in Apache Pulsar. Producing messages is the other half of the equation, and it’s worth spending some time talking about what responsibilities producers have in a Pulsar system. In general, Pulsar producers control the messages’ schema, routing strategy, encryption, and compression. The producer is the authority figure for messages and is mainly removed from the consumption of messages.

As you learned so far, Pulsar client libraries contain many knobs for tuning performance and allowing the end user to manage the flow of messages. Still, much of the complexity behind ensuring reliability in Pulsar happens with the brokers and in ZooKeeper and BookKeeper. In this chapter, we’ll cover some of the semantics of Pulsar producers and standard settings.

Synchronous Producers

Synchronous producers await acknowledgment from the Pulsar broker before considering a message or packet as having been “sent.” Synchronous producers provide the strongest guarantee around message delivery but have some implications for performance and may not be perfect for every application topology.

Figure 6-1 depicts an illustration of a sync send operation in Pulsar. When Message 1 (M1) is acknowledged by the Pulsar broker, M2 is sent, and so on.

A synchronous producer in Apache Pulsar. The producer sends messages M1, M2, and M3 and the broker acknowledges each message.
Figure 6-1. A synchronous producer in Apache Pulsar. The producer sends messages M1, M2, ...

Get Mastering Apache Pulsar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.