Flink Cross-Source Reads
An independent Flink job reads TDengine data, joins or processes it with other sources, and outputs results, optionally back to TDengine. It is outside taosX task scheduling. Verify the Flink job and final target.
Flink and the TDengine Flink connector have separate versions and dependencies. Check the actual delivered combination before deployment.
Where to operate: Flink job submission, SQL Client, and Web UI. Prepare TDengine data and topics in the taosExplorer Data Browser or taos CLI. This is not the taosX Data Publishing task entry point in taosExplorer.
Flink jobs perform reading and computation outside taosX scheduling. taosX does not manage Flink job startup, Checkpoints, or cross-source JOINs.
1. Choose the Read Method and Responsibilities
| Need | Method | Operational checks |
|---|---|---|
| Read a queryable data range | Flink Source query reads. | Query scope, time-split boundaries, time zone, and result count. |
| Continuously consume new TDengine data | Flink CDC Source subscription. | Topic, consumer group, starting position, Checkpoints, and WAL retention. |
| Join with other sources and output | Flink Table SQL or job logic. | Both connectors, field types, join keys, event time, and output. |
| Write back to TDengine | Flink Sink. | Target schema, permissions, duplicate handling, and failure semantics. |
The actual path is Flink execution node → taosAdapter → taosd. With WebSocket/JDBC, localhost refers to the Flink process or container, not universally to the browser, JobManager, or database host. Every execution node needing source access must reach configured addresses.
2. Confirm Before Deployment
For Enterprise Source, CDC, and Table Source, follow the Flink Connector Guide and its shared notes and examples. The ecosystem Flink page describes Sink and Table Sink; for reading data, use the Enterprise read guide.
Have Flink operations personnel obtain Enterprise connector packages and dependencies matching Flink, Java, and TDengine, and deploy according to the Flink Connector Guide. The guide requires Flink v1.19.0 or later, but this does not mean every later version and connector package has been verified. Connector versions are not taosX versions; do not map them mechanically.
The TDengine administrator supplies a read-only or subscription identity and prepares test data and topics. Flink operations records the job ID, source Topic, actual consumer group, Checkpoint directory and permissions, target output, and verification method. Check application development methods and connector parameters against the connector guide.
Choose the entry point below for the actual read method. The connector guide and shared notes are authoritative for full examples, connector versions, error codes, and type tables.
| Task | Authoritative entry point |
|---|---|
| Split queries by time, tags, or table name | Source Reads and Splits |
| Query results as regular rows, batches, or custom types | Use the Source Connector |
| Continuous reads and consumption positions | CDC Data Subscription |
| CDC regular rows, batches, and custom types | Use the CDC Connector |
| Read queries through SQL | Table Source Connector |
| Continuous subscription through SQL | Table CDC Connector |
3. Minimal Continuous-Read Example
Prepare isolated test data first. No MQTT or Kafka publishing task is needed:
In an isolated test environment, have an authorized TDengine TSDB administrator run the following SQL in the taosExplorer Data Browser or taos CLI. If the database name exists, use a new name and update subsequent topics and queries consistently. Do not overwrite business databases.
CREATE DATABASE taosx_out_demo PRECISION 'ms' WAL_RETENTION_PERIOD 86400;
CREATE STABLE taosx_out_demo.meters (ts TIMESTAMP, value DOUBLE)
TAGS (site VARCHAR(16));
CREATE TABLE taosx_out_demo.meter_1 USING taosx_out_demo.meters TAGS ('lab');
Create source objects and topics first, then prepare consumers for the selected method. Write test data after consumers are ready. Verify historical reads of existing data separately from continuous reads after subscription. Topic creation alone does not establish successful data transfer.
Have an authorized TDengine TSDB administrator create a dedicated query topic in the taosExplorer Data Browser or taos CLI:
CREATE TOPIC taosx_flink_topic AS
SELECT ts, value, site FROM taosx_out_demo.meters;
Run the following in a Flink SQL Client with the matching connector loaded, not in taos CLI:
SET 'execution.checkpointing.interval' = '10 s';
CREATE TABLE tdengine_test_source (
ts TIMESTAMP(3),
`value` DOUBLE,
site STRING
) WITH (
'connector' = 'tdengine-connector',
'td.jdbc.mode' = 'cdc',
'bootstrap.servers' = '<源taosAdapter主机>:6041',
'user' = '<订阅用户>',
'password' = '<订阅密码>',
'topic' = 'taosx_flink_topic',
'group.id' = 'taosx_flink_review',
'auto.offset.reset' = 'earliest',
'enable.auto.commit' = 'false'
);
SELECT ts, `value`, site FROM tdengine_test_source;
The example follows the connector guide's Table CDC entry point. Before production deployment, have Flink operations confirm options and type mappings with the actual delivered package. Supply passwords through controlled configuration, not shared SQL histories. Follow the Flink version's SQL Client display and job-lifecycle procedures. Exiting results does not necessarily cancel a remote job.
4. Verify Reads and Cross-Source Joins
- Find the actual job in Flink Web UI and confirm runtime state. On the Checkpoints page, confirm ongoing successful checkpoints, not just a configured interval.
- In TDengine's taosExplorer Data Browser or taos CLI, write a new record with a recognizable primary timestamp and value and save the source query result.
- Check the same timestamp, value, and tags in Flink SQL results, then write another timestamp to confirm continuous reading. Explicitly check JDBC and Flink time zones rather than only matching displayed text.
- For cross-source reads, verify the second source separately first, then have the job provider deliver join SQL. Use a known join key to verify matched, unmatched, late, and duplicate inputs. TDengine reads succeeding do not establish correctness of the other connector or join semantics.
- For database output, verify the final target by primary key and time window. Flink input counts alone do not prove completion.
5. Troubleshooting
| Symptom | Next action |
|---|---|
| Connector missing or option unrecognized | Inspect Flink exceptions and loaded JARs. Check package version, duplicate dependencies, and that package's parameter reference. Do not change the taosX plugin directory. |
| TDengine connection fails | Check taosAdapter address, TLS, authentication, and permissions from the actual TaskManager host or container. |
| Running but no old data | Check actual consumer-group positions, topic scope, and starting position. Do not mix these with taosX defaults. |
| Duplicates or missing data after restart | Check the latest successful Checkpoint, restored state, automatic commits, and source retention. |
| Reads work but join has no results | Check both sides' types, join keys, event time, and job filters. Do not rebuild the TDengine topic first. |
Use Flink Web UI exceptions and TaskManager logs to diagnose job issues, then check corresponding source subscriptions and service logs on TDengine. Do not look for this Flink job in SHOW XNODE TASKS.
For other task, write, and runtime issues, see Troubleshooting by Symptom.
6. Stop and Resume
Have Flink operations follow existing Stop, Savepoint, Cancel, and recovery procedures, recording saved locations and restore parameters. With enable.auto.commit=false, position commits depend on checkpoints; verify successful Checkpoints. Enabling automatic commits can advance positions before downstream processing and must not bypass recovery design.
Retain the intended consumer group and Flink state during recovery. Verify new data and the failure window before restoring full load. Obtain separate approval for failure drills. Do not stop taosX to test Flink Checkpoints.
7. Limitations
The example still requires on-site verification. It does not establish that the Flink link or cross-source joins have passed tests for the actual version combination. At-least-once processing, target primary-key overwrites, and downstream idempotency are not exactly-once transactions. Multisource snapshot consistency, conflict handling, and job development are not taosX product capabilities.