Pulsar Functions 提供三种不同的消息语义,可以应用于任何functions中:

Delivery semanticsDescription
At-most-once delivery发送给函数的每个消息最多会被处理一次
At-least-once delivery发送给函数的每条消息至少被处理一次
Effectively-once delivery发送函数的每条消息没精确的处理一次

在 function 中提供 processing guarantees

创建 Function 时,您可以为 Pulsar Function 设置 processing guarantees 。 例如, pulsar-function create 这一命令将对函数应用 effectively-once 保证,即发送给函数的每条消息均被精确处理一次:

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

可用选项包括:

  • 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.

在 function 中更新 processing guarantees

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