This section introduces the following content:
Pulsar Functions are a serverless computing framework that runs on top of Pulsar and processes messages in the following way:
The diagram below illustrates the three steps in the functions computing process.
Each time a function receives a message, it completes the following consume-apply-publish steps.
You can write functions in Java, Python, and Go. For example, you can use Pulsar Functions to set up the following processing chain:
raw-sentences
topic and “sanitizes” incoming strings (removing extraneous white space and converting all characters to lowercase) and then publishes the results to a sanitized-sentences
topic.sanitized-sentences
topic, counts the number of times each word appears within a specified time window, and publishes the results to a results
topic.results
topic and writes the results to a MySQL table.See Develop Pulsar Functions for more details.
Pulsar Functions perform simple computations on messages before routing the messages to consumers. These Lambda-style functions are specifically designed and integrated with Pulsar. The framework provides a simple computing framework on your Pulsar cluster and takes care of the underlying details of sending and receiving messages. You only need to focus on the business logic.
Pulsar Functions enable your organization to maximize the value of your data and enjoy the benefits of:
Below are two simple examples of use cases for Pulsar Functions.
This figure shows the process of implementing the classic word count use case.
In this example, the function calculates a sum of the occurrences of every individual word published to a given topic.
This figure demonstrates the process of implementing a content-based routing use case.
In this example, a function takes items (strings) as input and publishes them to either a fruits
or vegetables
topic, depending on the item. If an item is neither fruit nor vegetable, a warning is logged to a log topic.
For developers
For admins/operators