TDengine/docs/examples/JDBC/consumer-demo
She Yanjie 05ba8289a5
docs: jdbc release 3.7.6 (#33293)
* chore(jdbc): update jdbc version

* docs: jdbc release 3.7.6

* Update docs/en/14-reference/05-connector/14-java.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-10-17 16:24:15 +08:00
..
src/main/java/com/taosdata mod java code comments 2024-10-01 10:44:37 +08:00
pom.xml docs: jdbc release 3.7.6 (#33293) 2025-10-17 16:24:15 +08:00
readme.md move sample code to docs/example 2024-08-22 18:15:02 +08:00

How to Run the Consumer Demo Code On Linux OS

TDengine's Consumer demo project is organized in a Maven way so that users can easily compile, package and run the project. If you don't have Maven on your server, you may install it using

sudo apt-get install maven

Install TDengine Client and TaosAdapter

Make sure you have already installed a tdengine client on your current develop environment. Download the tdengine package on our website: https://www.taosdata.com/cn/all-downloads/ and install the client.

Run Consumer Demo using mvn plugin

run command:

mvn clean compile exec:java -Dexec.mainClass="com.taosdata.ConsumerDemo"

Custom configuration

# the host of TDengine server
export TAOS_HOST="127.0.0.1"

# the port of TDengine server
export TAOS_PORT="6041"

# the consumer type, can be "ws" or "jni"
export TAOS_TYPE="ws"

# the number of consumers
export TAOS_JDBC_CONSUMER_NUM="1"

# the number of processors to consume
export TAOS_JDBC_PROCESSOR_NUM="2"

# the number of records to be consumed per processor per second
export TAOS_JDBC_RATE_PER_PROCESSOR="1000"

# poll wait time in ms
export TAOS_JDBC_POLL_SLEEP="100"

Run Consumer Demo using jar

To compile the demo project, go to the source directory TDengine/tests/examples/JDBC/consumer-demo and execute

mvn clean package assembly:single

To run ConsumerDemo.jar, go to TDengine/tests/examples/JDBC/consumer-demo and execute

java -jar target/ConsumerDemo-jar-with-dependencies.jar