Processing guarantees

Pulsar Functions provides three different messaging semantics that you can apply to any function:

Delivery semanticsDescription
At-most-once deliveryEach message that is sent to the function will most likely be processed but also may not be (hence the "at most")
At-least-once deliveryEach message that is sent to the function could be processed more than once (hence the "at least")
Effectively-once deliveryEach message that is sent to the function will have one output associated with it

Applying processing guarantees to a function

You can set the processing guarantees for a Pulsar Function when you create the Function. This pulsar-function create command, for example, would apply effectively-once guarantees to the Function:

  1. $ bin/pulsar-admin functions create \
  2. --processing-guarantees EFFECTIVELY_ONCE \
  3. # Other function configs

The available options are:

  • ATMOST_ONCE
  • ATLEAST_ONCE
  • EFFECTIVELY_ONCE

By default, Pulsar Functions provide at-least-once delivery guarantees. So if you create a function without supplying a value for the —processingGuarantees flag, then the function will provide at-least-once guarantees.

Updating the processing guarantees of a function

You can change the processing guarantees applied to a function once it's already been created using the update command. Here's an example:

  1. $ bin/pulsar-admin functions update \
  2. --processing-guarantees ATMOST_ONCE \
  3. # Other function configs