Skip to main content
Version: v1.6.0

Run eventmesh-sdk-java demo

Maven Central

EventMesh-sdk-java as the client,and comminucate with eventmesh-runtime,to finish the message sub and pub

EventMesh-sdk-java support both async and broadcast.

EventMesh-sdk-java support HTTP, TCP and gRPC.

The test demos of TCP, HTTP 和 GRPC are in the module eventmesh-examples:

1. TCP DEMO

1.1 ASYNC

  • Start consumer to subscribe the topic (we have created the TEST-TOPIC-TCP-ASYNC by default, you can also create other topic to test)
Run the main method of org.apache.eventmesh.tcp.demo.sub.eventmeshmessage.AsyncSubscribe
  • Start producer to publish async message
Run the main method of org.apache.eventmesh.tcp.demo.pub.eventmeshmessage.AsyncPublish

1.2 BROADCAST

  • Start subscriber to subscribe the topic (we have created the TEST-TOPIC-TCP-BROADCAST by default, you can also create other topic to test)
Run the main method of org.apache.eventmesh.tcp.demo.sub.eventmeshmessage.AsyncSubscribeBroadcast
  • Start publisher to publish async message
Run the main method of org.apache.eventmesh.tcp.demo.pub.eventmeshmessage.AsyncPublishBroadcast

More information about EventMesh-TCP, please refer to EventMesh TCP

2 HTTP DEMO

2.1 ASYNC

  • The subscriber is a SpringBoot demo, so run this demo to start subscriber (we have created the topic TEST-TOPIC-HTTP-ASYNC by default, you can also create other topic to test)
Run the main method of org.apache.eventmesh.http.demo.sub.SpringBootDemoApplication
  • Start publisher to publish message
Run the main method of org.apache.eventmesh.http.demo.pub.eventmeshmessage.AsyncPublishInstance

More information about EventMesh-HTTP, please refer to EventMesh HTTP

3 GRPC DEMO

3.1 ASYNC PUBLISH & WEBHOOK SUBSCRIBE

  • Start publisher to publish message (we have created the topic TEST-TOPIC-GRPC-ASYNC by default, you can also create other topic to test)
Run the main method of org.apache.eventmesh.grpc.pub.eventmeshmessage.AsyncPublishInstance
  • Start webhook subscriber
Run the main method of org.apache.eventmesh.grpc.sub.app.SpringBootDemoApplication

3.2 SYNC PUBLISH & STREAM SUBSCRIBE

  • Start Request-Reply publisher to publish message (we have created the topic TEST-TOPIC-GRPC-RR by default, you can also create other topic to test)
Run the main method of org.apache.eventmesh.grpc.pub.eventmeshmessage.RequestReplyInstance
  • Start stream subscriber
Run the main method of org.apache.eventmesh.grpc.sub.EventmeshAsyncSubscribe

3.3 PUBLISH BATCH MESSAGE

  • Start publisher to publish batch message (we have created the TEST-TOPIC-GRPC-ASYNC by default, you can also create other topic to test)
Run the main method of org.apache.eventmesh.grpc.pub.eventmeshmessage.BatchPublishInstance

More information about EventMesh-gRPC, please refer to EventMesh gRPC

4. Run these demos by yourself

Please refer to EventMesh Store and EventMesh Runtime to finish the necessary deployment before try our demo

After finishing the deployment of store and runtime, you can run our demos in module eventmesh-examples:

gradle:

cd apache-eventmesh-1.9.0-src/eventmesh-examples
gradle clean dist

cd ./dist/bin

demo_1

4.1 TCP

TCP Sub

bash tcp_eventmeshmessage_sub.sh

Open the corresponding log file to view the log:

cd /root/apache-eventmesh-1.9.0-src/eventmesh-examples/dist/logs
tail -f demo_tcp_pub.out

demo_2

TCP Pub

bash tcp_pub_eventmeshmessage.sh

Open the corresponding log file to view the log:

cd /root/apache-eventmesh-1.9.0-src/eventmesh-examples/dist/logs
tail -f demo_tcp_sub.out

demo_3

4.2 TCP Broadcast

TCP Sub Broadcast

sh tcp_sub_eventmeshmessage_broadcast.sh

Open the corresponding log file to view the log:

cd /root/apache-eventmesh-1.9.0-src/eventmesh-examples/dist/logs
tail -f demo_tcp_sub_broadcast.out

demo_4

TCP Pub Broadcast

sh tcp_pub_eventmeshmessage_broadcast.sh

Open the corresponding log file to view the log:

cd /root/apache-eventmesh-1.9.0-src/eventmesh-examples/dist/logs
tail -f demo_tcp_pub_broadcast.out

demo_5

4.3 HTTP

HTTP Sub

sh http_sub.sh

Open the corresponding log file to view the log:

cd /root/apache-eventmesh-1.9.0-src/eventmesh-examples/dist/logs
tail -f demo_http_sub.out

demo_6

HTTP Pub

sh http_pub_eventmeshmessage.sh

Open the corresponding log file to view the log:

cd /root/apache-eventmesh-1.9.0-src/eventmesh-examples/dist/logs
tail -f demo_http_pub.out

demo_7

You can see the run logs for the different modes under the /logs directory.