Ingest Data into Pulsar
Set up Pulsar and Create Topics
Set up a Pulsar, taking Mac OSX for instance:
$ wget https://archive.apache.org/dist/pulsar/pulsar-2.3.2/apache-pulsar-2.3.2-bin.tar.gz
$ tar xvfz apache-pulsar-2.3.2-bin.tar.gz
$ cd apache-pulsar-2.3.2
# Start Pulsar
$ ./bin/pulsar standalone
Create Pulsar Topics:
$ ./bin/pulsar-admin topics create-partitioned-topic -p 5 testTopic
Create a Rule
Go to EMQX Dashboard, select the "rule" tab on the menu to the left.
Select "message.publish", then type in the following SQL:
SELECT
*
FROM
"message.publish"

Add an Action
Click on the "+ Add" button under "Action Handler", and then select "Data bridge to Pulsar" in the pop-up dialog window.
Fill in the parameters required by the action:
Two parameters are required by action "Data bridge to Pulsar":
1). Pulsar Topic
2). Bind a resource to the action. Since the dropdown list "Resource" is empty for now, we create a new resource by clicking on the "New Resource" to the top right, and then select "Pulsar":
Configure the Resource
Set the "Pulsar Server" to "pulsar://pulsar-broker1:6650" (multiple servers should be comma-separated), and keep the default values for all other configurations. Click the "Test" button to make sure the connection can be created successfully, and then click the "Create" button.
Pulsar Server
should be comma-separated Pulsar URLs, in format: pulsar://<hostname>:<port>
, or pulsar+ssl://<hostname>:<port>
if TLS is enabled on the Pulsar side.

Back to the "Actions" dialog, and then click on the "Confirm" button.

Back to the creating rule page, then click on "Create" button. The rule we created will be shown in the rule list:

Test the Rule
We have finished creating the rule, test the rule by sending an MQTT message to EMQX:
Topic: "t/1"
QoS: 0
Retained: false
Payload: "hello"
Then inspect the Pulsar by consuming the topic, and verify if a new record has been produced:
\$ ./bin/pulsar-client consume testTopic -s "sub-name" -n 1000
And from the rule list, verify that the "Matched" column has increased to 1:
Use Basic/Token Authentication for Pulsar
Starting at EMQX Enterprise 4.3.10 and 4.4.4, we support basic
and token
authentication when connecting to Pulsar.
For example, to enable token
authentication, select token
from the Authentication Type
drop-down list:

And then provide the JWT in the bottom of the dialog box:
