This simple demo aims at setting up a few components to mock a company information system (let’s call it five-cents…), and to expose them into the container and orchestration world (Docker, Docker compose, Kubernetes, OpenShift).
To make this more fun, we will take benefit of setting up this sandbox to embrace some interesting concepts, with very simple and lightweight developments like :
- Exposing REST resources as microservices with Thorntail (WildFly Swarm) or SpringBoot
- Building Enterprise Integration Patterns to glue these services with Apache Camel
- Exploring Circuit Breaker and Bulkhead patterns
The finality will be :
- Mounting these elements in Docker containers
- Orchestrating them with Kubernetes and OpenShift
Here is the architecture of the system used throughout the demo :
To simplify the system, only one service is exposed per system.
The backend tier gathers Legacy information systems of the five-cent structure. The middleware tier goal is to expose the Legacy systems as microservices for Client and Contract domain. Inside the middleware tier, the exposition layer offers an urbanized vision of a domain, and the orchestration layer gives higher-level services.
The full source code is available on GitHub at :
Zoom on the different components of the five-cents company
The five-cents new Client system
This system simulates a new information system developed at five-cents company, to replace the old SOAP system. It exposes a simple single REST resource on the Client domain, on Thorntail (WildFly Swarm) JavaEE micro-service system.
Micro-service systems must be resilient, and not trust the references they call. Patterns like Circuit Breaker and Bulkhead can help us to protect our services, we will test Netflix OSS Hystrix to achieve this, and our ‘client-brandnew’ system will be used to simulate errors, and long timeouts.
This small Java EE 7 micro-service application is written with these concepts :
– Java EE (CDI, JAX-RS resources)
– Code-first JAX-RS classes
– REST HATEOAS micro-service
– Swagger documentation, and embedded Swagger UI application
– Simulation of errors and slowness for Circuit Breaker and Bulkhead
Here is the list of uptodate articles linked with the new Client system :
- Exposing JEE JAX-RS resources under Thorntail with Swagger and Swagger-UI embedded
- Producing some REST HATEOAS navigation elements with JAX-RS 2.0
- WebSocket simple implementation for checking javax.interceptor.Interceptors moderator actions
The sources of the service is available on GitHub : https://github.com/lcailleteau/fivecents-microservices-demo/tree/master/backends/client-brandnew and https://github.com/lcailleteau/fivecents-microservices-demo/tree/master/framework/utils
The five-cents old Client system
This system simulates the Client Legacy system of the five-cent company. This legacy system should be a full monolithic Enterprise Service Bus with highly contractual messages in SOAP format over HTTP. Of course we are not bringing the big picture here, so we restrict it to one single simple SOAP Web Service.
Actually the new client system has not taking into account addresses or clients for now (maybe in a future version), so we still need to request the old client system with legacy clients ids to get these addresses and have a complete Client picture.
This small Java EE 7 application is written with these concepts (actually far from a heavy SOA system) :
– Java EE (CDI, JAX-WS annotations)
– Code-first JAX-WS classes
Here is the list of uptodate articles linked with the old Client system :
The sources of the service is available on GitHub : https://github.com/lcailleteau/fivecents-microservices-demo/tree/master/backends/client-legacy/src/test/java/com/fivecents/backends/clientlegacy and https://github.com/lcailleteau/fivecents-microservices-demo/tree/master/framework/utils
The five-cents Contract system
For the Contract information system, we are just mocking a few REST Client responses through SoapUI, to get contracts for our clients.
Nothing special here actually, here is the list of uptodate articles linked with the Contract system :
The sources of the service is available on GitHub : https://github.com/lcailleteau/fivecents-microservices-demo/tree/master/backends/contract
The urbanized Client system
We will introduce here the use of an aggregator EIP, using Camel for its implementation. The microservice will be exposed as REST resource under Thorntail.
This service will serve our tests on NetFlix OSS Hystrix commands, to get protection from errors and timeouts of the Client systems.
- To come : NetFlix OSS Hystrix CircuitBreaker protection sample in Camel routes
The urbanized Contract system
For the Contract system, our middleware microservice will still be implemented in Camel, exposing REST resources with Spring REST annotations, and SpringBoot, for a change. That will show us some key differences with Thorntail.
The complete Client system
For the top level service, aggregating client and contract data from lower tiers, we will try to make a Contract-first approach, using ApiCurio to design our REST resources, and importing the results into Camel REST service implementation.
As a second exercise, we will make the adventure real, bringing this whole system to the cloud world, Docker, Kubernetes and OpenShift !
Leave a Reply