Skip to main content

Pulsar

info

Apache Pulsar and Tuya Pulsar ingestion differ in authentication, subscriptions, and sampling. Select the branch for the platform in use. A consumer name does not replace a subscription name, and Tuya server retrieval may use the production subscription.

Navigation: taosExplorer → Data In → Pulsar or Pulsar-Tuya. Run SQL in taosExplorer's Data Browser or the taos CLI.

Apache Pulsar and Tuya Pulsar each use their corresponding connector. The actual reads run on taosX or the selected taosX-Agent. That host must be able to access the Broker and use the required authentication files.

1. Prepare a subscription and test data​

Obtain the Broker address, fully qualified topic name, read permissions, and authentication method from the Pulsar administrator. An Apache Pulsar topic can look like persistent://public/default/taosx_test; replace the tenant, namespace, and topic with actual values. Use a separate test subscription to avoid affecting production subscriptions.

ItemPrerequisite
Source networktaosX or the selected taosX-Agent can access the Broker and the actual connection addresses returned by the server. Distinguish TLS ports from plain ports using values supplied by the source.
Source permissionsPermission to consume the selected topic and use the subscription. Use a dedicated test subscription without competing with business consumers.
Authentication materialsObtain the username/password, JWT, client certificate/private key, or custom authentication name and data matching the source configuration. Do not mix credentials from different branches.
Target permissionsA TDengine administrator has prepared a separate test database, supertable, and write identity.
Messages and verificationThe source administrator can send identifiable test messages to the dedicated topic and record their actual publication times and content.

Have an authorized TDengine TSDB administrator create the test database and supertable:

CREATE DATABASE pulsar_demo PRECISION 'ms';
CREATE STABLE pulsar_demo.temperatures (ts TIMESTAMP, temperature DOUBLE)
TAGS (device VARCHAR(32));

2. Minimal Apache Pulsar ingestion​

  1. On the Data In page, click Create New Task. Enter pulsar_demo_reader as the name, select Pulsar as the type, and select pulsar_demo as the target database. If an Agent is needed, select a deployed, online taosX-Agent. If none is deployed, first follow Agent deployment and maintenance. Browser access to the Broker does not prove Agent access.
  2. Enter the administrator-provided Broker address and select Basic Auth, JWT, mTLS, or Custom Authentication according to the server. Leave authentication fields empty only if the source truly has authentication disabled. Do not use a JWT Token as a username/password or disable source authentication for testing without approval.
  3. Enter the fully qualified topic, dedicated consumer name, and subscription name. Explicitly select Earliest for the first test, match the producer's character encoding, and check connectivity.
  4. Enter {"device":"d001","ts":1795132800000,"temperature":23.5} as the message body and parse it as JSON. Select temperatures as the target, use child-table template t_{device}, map ts in milliseconds, temperature as a number, and device as a tag. Then check the mapping preview.
  5. After submitting, return to the task list, find pulsar_demo_reader, and confirm it has started. Have the producer send the same message to the actual topic. Its timestamp is 2026-11-20T00:00:00Z. If this is outside target retention, change both the message and query to a timestamp within retention.

2.1 Authentication branches​

Configure only the authentication method actually used by the source. If the connection fails, do not cycle through unrelated credentials. Certificate materials belong to the host that performs the reads. Check UI uploads separately from local file references in a taosx run DSN.

MethodRequired materialsChecks
Basic AuthUsername and passwordCorresponds to connection parameters ba_username and ba_password, not the TDengine login identity.
JWTComplete TokenCorresponds to jwt_token. Check expiration, issuance scope, and subscription permissions. Do not enter it in the username field.
mTLSClient certificate and matching private keyCorresponds to cert and cert_key. Follow the Broker configuration for connection ports and certificate trust. A CA alone cannot replace the client identity.
Custom AuthenticationSource-defined authentication name, authentication data, and TLS settingCorresponds to custom_auth_name, custom_auth_data, and custom_is_ssl. The source authentication mechanism defines the format. Arbitrary JSON is not a universal format.

Start with one reachable Broker Server entry, such as pulsar-host:6650. This is only an entry point and does not ensure that all Broker addresses returned by the server are reachable. Do not disable certificate verification to work around TLS errors.

Apache Pulsar Broker Server configuration

View configuration fields for the four authentication methods

Select Basic-Auth and enter the source username and password.

Pulsar Basic Auth username and password

Select JWT and enter the complete Token.

Pulsar JWT Token input

Select mTLS and provide the client certificate and matching private key separately. Do not upload a private key as a CA.

Pulsar mTLS client certificate and private-key inputs

Select Custom Authentication and enter the source-defined method name, authentication data, and whether to use SSL.

Pulsar custom authentication method, data, and SSL option

2.2 Collection options​

OptionConfiguration and behavior
TopicsFully qualified Topics, separated by commas, for example persistent://public/default/tp1,persistent://public/default/tp2. Topics must be within the authorized scope.
Consumer nameIdentifies the running instance; it is not consumption progress itself. Use a name such as taosx_demo_reader. Record the name actually saved rather than deriving it from the taosx prefix or task-ID switch in older images. A direct DSN uses the full name entered.
Subscription nameEnter a source-approved dedicated subscription, such as taosx_demo_sub, to associate consumption state. Preserve it across restarts and takeovers. Renaming may reread or skip existing data.
Initial PositionEarliest or Latest, defaulting to Earliest when omitted. It does not force a reset of an existing subscription position.
TimeoutThe page uses milliseconds. Explicit 0 waits continuously; a finite no-message timeout may end the task. This is not a target write timeout.
Character encodingMatch the producer: UTF_8, GBK, GB18030, or BIG5. Explicitly select UTF_8 for the first test and check a real sample containing Chinese text.

The image below uses this page's example: topic persistent://public/default/taosx_test, consumer taosx_demo_reader, subscription taosx_demo_sub, timeout 0 milliseconds, initial position Earliest, and encoding UTF_8. These are configuration examples. Replace them with source-approved objects, then check connectivity and ingestion.

Pulsar example topic, consumer, subscription, initial position, and timeout

Collection uses Failover subscriptions. If multiple consumers share a topic and subscription, one may actively read while the others stand by; they do not each receive a complete independent stream. Use a separate subscription for the exercise. If two workloads each need a complete read, have the source administrator allocate separate subscriptions and confirm topic retention and permissions.

After Check Connectivity, still send real messages and query target records. A successful check proves only the checked path, not that the production subscription has consumed messages, parsing has succeeded, or data has been written.

Apache Pulsar's Retrieve from Server uses a separate sample subscription and unsubscribes from it on normal completion. The source account also needs the corresponding permissions. Tuya sampling has different subscription behavior, described below. Do not assume Apache's sample isolation applies to Tuya.

2.3 Complete message parsing and target mapping​

Continue with pulsar_demo.temperatures and the temperature JSON above to complete these parsing and mapping steps.

  1. Select json under Payload Transformation and preview it. Confirm that device is a string and ts and temperature are numeric. If rule blocks are present, keep one block for the single structure with match expression true. This example adds no extraction, splitting, or filtering.
  2. In the selected target database, select temperatures and enter t_{device} as the child-table template. Map source ts in milliseconds to the primary timestamp, temperature to a DOUBLE data column, and device to a tag.
  3. The mapping preview should generate t_d001, temperature 23.5, and tag d001, with the sample's timestamp. Fix rules first if values are null or types are wrong. Preview neither publishes messages nor writes to the target. Submit and start the task, then send real messages for verification.

For sample input, see Samples and previews. When extending rules, see Extraction, splitting, filtering, and transformation and Target mapping.

If topics have different message structures, configure matching rules separately using Parsing (JSON, Regex, UDT) and prepare samples for each structure. One topic sample cannot verify every topic.

3. Tuya ingestion​

Create a task on the Data In page, with a name such as tuya_demo_reader. Select Pulsar-Tuya as the type, the administrator-prepared target database, and the actual collection Agent. Enter the platform-provided Broker, Access Id, Access Key, and execution environment. Tuya ingestion configuration generates the topic, consumer, and subscription identifiers. Do not reuse the Apache Pulsar topic and subscription settings above.

Select the actual platform environment: prod for production or test for testing. They use different event topics. Credentials and Broker must come from the same region and project. Valid credentials do not mean message subscriptions are enabled for the project. Have the Tuya administrator confirm the device and subscription scope. Do not manually enter Apache consumer, subscription, or Topic values to override platform-generated values.

Generated itemRuleOperations check
Consumer nametaosx-{Access Id}Do not replace this identifier with the task display name.
Subscription name{Access Id}-subMultiple tasks using the same identity may share this subscription. This does not mean each task has an independent data copy.
Production topic{Access Id}/out/eventCorresponds to prod. Confirm that production device events are enabled on the platform.
Test topic{Access Id}/out/event-testCorresponds to test. Test-environment messages do not prove the production topic is readable.

Braces in the table indicate values to replace with the platform-provided Access Id. Do not enter the braced text in the UI. Tuya connections use TLS but do not strictly verify server certificates and hostnames. If production policies require strict identity verification, confirm a compliant delivery solution with technical support first. A successful connection does not constitute successful security verification.

Tuya Access Id, Access Key, and execution environment fields

Tuya collection requires only timeout, initial position, and encoding settings

Select the initial position and encoding, check connectivity, then configure JSON parsing and mapping with a real Tuya message. The actual product determines the message structure; do not assume it has the fields in the test JSON above. Start with an identifiable device event, record its timestamp and device ID, then submit and verify the corresponding target record.

warning

Tuya's Retrieve from Server uses the automatically generated production subscription above and acknowledges the sample messages it receives. It may compete with running consumers of the same subscription, and sampling itself does not write messages to the target table. For initial modeling, prefer an approved, sanitized sample supplied by the platform administrator in Message Body. Do not repeatedly sample a production subscription. If server sampling is necessary, first confirm the test identity, events, and subscription impact with the source administrator and record the sampled events. After starting the production task, send a new event to verify ingestion. Do not assume acknowledged samples will be redelivered.

Tuya tasks follow the same parsing, extraction, filtering, and mapping sequence above, using actual device-event fields at every step. First confirm event-time units, device IDs, and business values with the source administrator, then have the TDengine administrator prepare the corresponding target table. Do not write arbitrary events to the temperature example table just because it exists. After submitting, return to the task list to check the actual task state, then query the corresponding target record using the recorded device and event time.

4. Advanced options and write-error policies​

Check each Apache Pulsar and Tuya task's Advanced Options and Error Handling Policy before submitting. Record read batches, concurrency, and health settings from the current form rather than using Kafka initial values. Authentication failures occur at the source and cannot be fixed by a target-connection-error cache policy. Do not assume the original subscription automatically redelivers messages after they are archived or discarded. For Tuya tasks, check parsing failures and missing fields with actual device events, not the successful Apache exercise sample.

Expand Advanced Options and keep initial values while completing a small write test. If backlog or latency warrants tuning, change only one item at a time and record metrics and target data before and after. The following values are displayed in a new form. For existing tasks, use saved values; do not overwrite the original policy with form initial values.

Pulsar read concurrency, batches, writes, and health options

OptionNew form and usage
Maximum read concurrencyInitially 0, configured from the expanded topic partition count. This is not a hard upper limit in all cases: a small positive value still creates at least as many consumers as partitions. Additional consumers may only add Failover standbys.
Batch sizeInitially 1000, a sending threshold for read messages, not a unique target row count or hard per-batch limit. Parsing/splitting, filtering, and primary-key overwrites affect target rows.
Write concurrencyInitially empty; use automatic configuration first. This belongs to target writes. A shared source-DSN field with the same name does not necessarily correspond to this UI setting.
Health monitoring periodDisplays 0 seconds. Use Health checks and no-data diagnosis to distinguish the monitoring window, task management status, and actual data.
Busy thresholdDisplays 100%. After Busy appears, first locate the bottleneck in source reads, processing, or target writes using Logs and performance, then decide how to tune.
Write queue lengthInitially 1000, not the byte capacity of raw messages. Confirm execution-host memory and target throughput before increasing it. A large queue does not resolve sustained backlog.
Write error thresholdDisplays 10. Check actual errors and health documentation. Do not interpret this as “the tenth failure always stops the task” or assume all failures are fully archived.

A direct DSN also supports read-batch wait batch_timeout, defaulting to 1000 milliseconds. It differs from no-message timeout and from the MQTT default. For types, defaults, conditions, and authentication parameters, see Pulsar parameters.

For archive retrieval and backfill boundaries, see Write errors and exception data. For tuning steps, see Tuning and resource control.

5. Key settings and verification​

The subscription name determines which consumption state is associated during recovery; the consumer name cannot replace it. Check actual saved names rather than recording only raw input. Initial Position values Earliest/Latest do not reposition an existing subscription on every restart.

For the Apache Pulsar example above, run in taosExplorer's Data Browser or the taos CLI:

SELECT ts, temperature, device FROM pulsar_demo.t_d001
WHERE ts = 1795132800000;

Confirm temperature 23.5, device tag d001, and the sample timestamp. Then send a message with a new timestamp to check continuous ingestion. Query Tuya tasks using the actually mapped table, columns, and event time, not a sample query that does not match the message structure.

6. Troubleshooting​

SymptomAction
Broker is reachable, but authentication failsCheck the selected authentication type, Token, or certificates. For Tuya, also check that the environment and Access credentials belong together.
No messages arriveCheck fully qualified topic names, read permissions, actual subscriptions, and source retention, not just consumer names. Then check whether another Failover active consumer already uses the same topic and subscription. Do not delete subscriptions or seek to the end to troubleshoot.
The task ends normally after running for a long timeCheck for a positive no-message timeout and Pulsar task timeout in logs. Use 0 when continuous collection requires continuous waiting, then check whether messages received before completion were ingested. Do not always diagnose this as authentication failure.
Tuya authentication succeeds, but event decryption failsCheck Access Id, Access Key, project, and message environment. Use real device events from that project. Retrieve a new sample and confirm business fields; ordinary Apache test JSON cannot replace platform events.

For other task, write, and runtime issues, see Troubleshooting by symptom.

7. Stop, recover, and limitations​

Preserve the subscription, configuration, and target mapping when stopping the original task. After recovery, check data before and after downtime using the original subscription. Do not arbitrarily delete subscriptions to retrieve old messages. Check source retention, acknowledgment progress, and interruption rereads separately. Recovery of all downtime data is not guaranteed.

In a direct DSN, seek_to_end=true in Apache Pulsar unsubscribes the original subscription and creates a new Latest consumer. It may skip unconsumed data and affect other workloads sharing the subscription. Do not use it for normal recovery or troubleshooting to “see new data first.” Tuya does not support resetting subscriptions with this parameter; do not set it for normal ingestion.

Recovery verification must check at least three messages: the last before downtime, one retained at the source during downtime, and one newly sent after recovery. Compare device IDs, event times, and business values individually. A running task or increasing acknowledgment count does not prove completeness during the downtime window. For messages no longer retained at the source, have the source administrator provide a separate backfill plan.

Verify TLS, custom authentication, and production message structures separately. For further troubleshooting, see No data on first ingestion.