Skip to content

vkuzm/JMS-ActiveMQ-Cart-Order

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JMS ActiveMQ Cart - Order

Simple example how Spring JMS + ActiveMQ work together to save the cart from one service to another.

Run ActiveMQ in the Docker

docker run -p 8161:8161 -p 61616:61616 --name activemq webcenter/activemq:latest

ActiveMQ admin panel

http://localhost:8161/admin/

Login: admin
Password: admin

Cart service

Method Resource Description
POST /cart/saveOrder Save an order

Order service

Method Resource Description
GET /orders Get all orders
GET /orders/{id} Get one order

Testing

Save order:

curl -X POST \ http://localhost:8081/cart/saveOrder \ -H 'Accept: */*' \ -H 'Accept-Encoding: gzip, deflate' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Length: 537' \ -H 'Content-Type: application/json' \ -H 'Host: localhost:8081' \ -H 'Postman-Token: 09ab565e-42b6-49a4-be12-6a24d0e07040,3284bf6e-b956-4e16-8032-4eeab29eb730' \ -H 'User-Agent: PostmanRuntime/7.19.0' \ -H 'cache-control: no-cache' \ -d '{ "firstName": "Thomas", "lastName": "White", "address": "New York street 155.5", "products": [ { "productId": 1, "name": "Iphone X", "quantity": 1, "price": 1500 }, { "productId": 2, "name": "Cannon X1500", "quantity": 1, "price": 5500 } , { "productId": 3, "name": "Samsung TV", "quantity": 2, "price": 4500 } ] }'s

Find all orders:

curl -X GET \ http://localhost:8081/orders \ -H 'Accept: */*' \ -H 'Accept-Encoding: gzip, deflate' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Host: localhost:8081' \ -H 'Postman-Token: af7de86a-1b9e-44cb-8fab-fb59f75aa22f,df247439-35d8-4544-ac7b-c977571bfd82' \ -H 'User-Agent: PostmanRuntime/7.19.0' \ -H 'cache-control: no-cache'

Find one order:

curl -X GET \ http://localhost:8081/orders/1 \ -H 'Accept: */*' \ -H 'Accept-Encoding: gzip, deflate' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/json' \ -H 'Host: localhost:8081' \ -H 'Postman-Token: bae64828-286b-47fe-a8b5-480a4395dd49,9abec91b-122e-4f70-a500-701692a8a4ae' \ -H 'User-Agent: PostmanRuntime/7.19.0' \ -H 'cache-control: no-cache'

Releases

No releases published

Packages

No packages published

Languages