Skip to content

kawgh1/micro-beer-inventory-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Part of John Thompson's Microservices course

For microservices to use JMS Messaging on localhost, Docker must be installed and localhost must be connected to an ActiveMQ Server

https://github.com/vromero/activemq-artemis-docker

defaults for this docker image - github.com/vromero/activemq-artemis

spring.artemis.user=artemis spring.artemis.password=simetraehcapa

Docker ActiveMQ

Beer Service is responsible for generating the Beer objects used in the application and stores that Beer object data in a database. Beer Order Service and Beer Inventory make calls to Beer Service to get information about the Beer objects.

Beer object example:

  • UUID id = '026cc3c8-3a0c-4083-a05b-e908048c1b08'
  • String beer_name = 'Pinball Porter'
  • String beer_style = 'PORTER'
  • Timestamp created_date = CURRENT_TIMESTAMP
  • Timestamp last_modified_date = CURRENT_TIMESTAMP
  • Integer min_on_hand = 12
  • Integer quantity_to_brew = 200
  • BigDecimal price = 12.95
  • String upc = '0083783375213'
  • Long version = 1

Default Port Mappings - For Single Host

Service Name Port
Brewery Beer Service 8080
Brewery Beer Order Service 8081
Brewery Beer Inventory Service 8082

CircleCI

Micro Beer Inventory Service - Microservice

Steps for Deconstruction into Microservices

1. Dependency Management

2. (Local) MySQL Configuration

3. JMS Messaging

4. JMS with Microservices

5. Spring State Machine

6. Using Sagas with Spring

7. Integration Testing Sagas

8. Compensating Transactions

9. Spring Cloud Gateway

10. Service Registration

11. Service Discovery

12. Circuit Breaker

Docker ActiveMQ

  1. Running the image

There are different methods to run a Docker image, from interactive Docker to Kubernetes and Docker Compose. This documentation will cover only Docker with an interactive terminal mode. You should refer to the appropriate documentation for more information around other execution methods.

To run ActiveMQ with AMQP, JMS and the web console open (if your are running 2.3.0 or later), run the following command:

MAC

docker run -it --rm
-p 8161:8161
-p 61616:61616
vromero/activemq-artemis

WINDOWS docker run -it --rm -p 8161:8161 -p 61616:61616 vromero/activemq-artemis

After a few seconds you'll see in the output a block similar to:


/ \ | | ___ __ __() _____
/ _ | _ \ __|/ _ \ / | |/ __/
/ ___ \ | / |
/ / |/| | |_ \
/
/ _| __|| |||/__ /
Apache ActiveMQ Artemis x.x.x

HH:mm:ss,SSS INFO [...] AMQ101000: Starting ActiveMQ Artemis Server

At this point you can open the web server port at 8161 and check the web console using the default username and password of artemis / simetraehcapa.