https://github.com/mehdi-reza/microprofile-service
Microprofile has everything but Microservice!
https://github.com/mehdi-reza/microprofile-service
eclipse jakartaee javaee8 microprofile microservice
Last synced: 7 months ago
JSON representation
Microprofile has everything but Microservice!
- Host: GitHub
- URL: https://github.com/mehdi-reza/microprofile-service
- Owner: mehdi-reza
- Created: 2018-11-28T07:24:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-08T11:56:32.000Z (almost 7 years ago)
- Last Synced: 2025-01-22T08:11:25.945Z (9 months ago)
- Topics: eclipse, jakartaee, javaee8, microprofile, microservice
- Language: Java
- Homepage:
- Size: 49.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## microprofile-service
The objective is to make writing microservices easy by doing the heavy lifting of CDI and JaxRS and handle orchestration which can be defined by the microservices developer through code.
Steps
- Create your microservice "microservice-a" as a maven project (war) with org.microprofile:microservice dependency
- Write your service class which implements org.microprofile.microservice.Microservice
- Annotate it with service descriptor @ServiceDescriptor
- Make sure beans.xml is present in WEB-INF folder
- Create microprofile-config.properties in src/main/resources/META-INF with following properties:`zookeeper.connect.string=localhost:2181`
`zookeeper.connect.timeout=3000`
The above is to register your microservice in zookeeper with its URL, this URl can be reversed proxy by a webserver (load balanced among multiple instances)
The zookeeper should already have a zNode /services with acl world:anyone:cdrwa
Check the sample microservice https://github.com/mehdi-reza/microservice-a
### Run
Run with payara micro as following:java -jar payara-micro-5.183.jar microservice-a.war
curl -s http://localhost:8080/microservice-a/service
## Orchestration
Orchestration is to be introduced by the means where microservice provider will provide information about next service call (in service method) using RequestContext.next(serviceName). It will be the responsibility for the orchestrator to co-ordinate service invocations between multiple services and also fire compensatation events to microservices in case of failures.
Any microservice can become orchestrator if it is the first participant in multiple service invocations.
A lot of other features can also be added like open tracing, security etc.