quickstarts/pub_sub/java/sdk
Pravin Pushkar 85f6c6cc66
Feature/java sdk pubsub quickstarts (#533)
* Code example for Pubsub component using Dapr Java SDK

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* Incorporating review comments

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

* Update pub_sub/java/sdk/README.md

Co-authored-by: Paul Yuknewicz <paulyuk@microsoft.com>
Signed-off-by: Artur Souza <artursouza.ms@outlook.com>

* Removing double quotes

Signed-off-by: Pravin Pushkar <ppushkar@microsoft.com>

Co-authored-by: Artur Souza <asouza.pro@gmail.com>
Co-authored-by: Paul Yuknewicz <paulyuk@microsoft.com>
2022-02-17 11:54:30 -08:00
..
checkout Feature/java sdk pubsub quickstarts (#533) 2022-02-17 11:54:30 -08:00
order-processor Feature/java sdk pubsub quickstarts (#533) 2022-02-17 11:54:30 -08:00
.gitignore Feature/java sdk pubsub quickstarts (#533) 2022-02-17 11:54:30 -08:00
README.md Feature/java sdk pubsub quickstarts (#533) 2022-02-17 11:54:30 -08:00

README.md

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 the Dapr client SDK. If you are looking for the example using only HTTP click here.

This quickstart includes one publisher:

  • Java client message generator checkout

And one subscriber:

  • Java subscriber order-processor

Pre-requisites

Run Java message publisher app with Dapr

  1. Open a new terminal window and navigate to checkout directory:
cd checkout
  1. Install dependencies:
mvn clean install
  1. 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

  1. Open a new terminal window and navigate to order-processor directory:
cd order-processor
  1. Install dependencies:
mvn clean install
  1. 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