mirror of https://github.com/dapr/quickstarts.git
2.5 KiB
2.5 KiB
Dapr Configuration API
In this quickstart, you'll create a microservice which makes use of Dapr's Configuration API. Configuration items are key/value pairs containing configuration data such as app ids, partition keys, database names etc. The service gets configuration items from the configuration store and subscribes for configuration updates.
Visit this link for more information about Dapr and Configuration API.
This quickstart includes one service:
- Java service
order-processor
Prerequisites
- Maven 3.x
- Java JDK 11 (or greater):
- Locally running redis container - a redis container named
dapr_redisis automatically created when you rundapr init
Add configuration items to the config store
- Open a new terminal and set values for config items
orderId1andorderId2by using the command below
docker exec dapr_redis redis-cli MSET orderId1 "101" orderId2 "102"
Build the Java file
cd ./order-processor
mvn clean install
Run order-processor
- Navigate to
order-processordirectory. - Run the service app with Dapr.
cd ./order-processor
dapr run --app-id order-processor --components-path ../../../components -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
(Optional) Update value of config items
- Keep the
order-processorapp running and open a separate terminal - Change the values of
orderId1andorderId2using the command below order-processorapp gets the updated values of config items
docker exec dapr_redis redis-cli MSET orderId1 "103" orderId2 "104"