This Docker image provides a Spring Boot application for managing user orders in an e-commerce platform. It allows adding products to a cart, calculating cart totals, and processing purchases.
In version 2.0.0, the Order Management Microservice is updated to include MongoDB integration, which relies on environment variables to configure the MongoDB connection and other application settings.
docker run --network my-network \
-e PRODUCT_INVENTORY_API_HOST=http://product-inventory \
-e PRODUCT_CATALOG_API_HOST=http://product-catalog \
-e SHIPPING_HANDLING_API_HOST=http://shipping-and-handling \
-e SPRING_DATA_MONGODB_URI=mongodb://host:27017/name \
-e SPRING_DATA_MONGODB_DATABASE=order_management \
-p 9090:9090 --name order-management obodochriz/order-management
To run a container from this image, use the following command:
docker run --network my-network \
-e PRODUCT_INVENTORY_API_HOST=http://product-inventory \
-e PRODUCT_CATALOG_API_HOST=http://product-catalog \
-e SHIPPING_HANDLING_API_HOST=http://shipping-and-handling \
-p 9090:9090 --name order-management obodochriz/order-management
The microservice will be accessible at http://localhost:9090.
POST /api/orders/{userId}/cart: Adds a product to the user's cart.GET /api/orders/{userId}/cart/subtotal: Retrieves the cart subtotal for the user.GET /api/orders/{userId}/cart/shipping: Retrieves the shipping total for the user's cart.GET /api/orders/{userId}/cart/total: Retrieves the total cart value including shipping for the user.POST /api/orders/{userId}/purchase: Processes the purchase of the user's cart.GET /api/orders/{userId}/cart: Retrieves all items in the user's cart.The container requires the following environment variables to be set:
PRODUCT_INVENTORY_API_HOST: The URL of the product inventory microservice.PRODUCT_CATALOG_API_HOST: The URL of the product catalog microservice.SHIPPING_HANDLING_API_HOST: The URL of the shipping and handling microservice.These variables are used by the application to communicate with the necessary microservices to fetch product details, inventory status, and shipping information.
To ensure the Order Management microservice can communicate with the required microservices, it should be connected to the same Docker network. Here’s how you can set it up:
Create a Docker network if you haven't already:
docker network create my-network
Run the Order Management microservice along with the other microservices on the same network, using the --network flag as shown in the usage example.
To build the Docker image yourself, follow these steps:
docker build -t obodochriz/order-management .
If you would like to contribute to the Order Management microservice, please follow the contributing guidelines outlined in the CONTRIBUTING.md file.
This project is licensed under the MIT License.
For any issues or questions regarding this Docker image or the Order Management microservice, please open an issue on the GitHub repository.
Content type
Image
Digest
sha256:8c75c63ab…
Size
313.8 MB
Last updated
over 2 years ago
docker pull obodochriz/order-management