mirror of https://github.com/dapr/quickstarts.git
1.8 KiB
1.8 KiB
Dapr pub/sub
In this quickstart, there is a publisher microservice checkout and a subscriber microservice order-processor to demonstrate how Dapr enables a publish-subscribe pattern. checkout generates messages and publishes to a specific orders topic, and order-processor subscribers listen for messages of topic orders.
Visit this link for more information about Dapr and Pub-Sub.
Note: This example leverages HTTPClient only. If you are looking for the example using the Dapr Client SDK (recommended) click here.
This quickstart includes one publisher:
- Java client message generator
checkout
And one subscriber:
- Java subscriber
order-processor
Pre-requisites
- Dapr and Dapr Cli.
- Java JDK 11 (or greater): Oracle JDK or OpenJDK.
- Apache Maven version 3.x.
Run Java message publisher app with Dapr
- Open a new terminal window and navigate to
checkoutdirectory:
cd checkout
- Install dependencies:
mvn clean install
- Run the Java publisher app with Dapr:
dapr run --app-id checkout --components-path ../../../components -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
Run Java message subscriber app with Dapr
- Open a new terminal window and navigate to
order-processordirectory:
cd order-processor
- Install dependencies:
mvn clean install
- Run the Java subscriber app with Dapr:
dapr run --app-port 8080 --app-id order-processor --components-path ../../../components -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar