digital-restaurant

DDD. Event sourcing. CQRS. REST. Modular. Microservices. Kotlin. Spring. Axon platform. Apache Kafka. RabbitMQ

View the Project on GitHub idugalic/digital-restaurant

Microservices / Websockets / AxonServer

:octocat: /drestaurant-apps/drestaurant-microservices-websockets :octocat:

This is a thin layer which coordinates the application activity. It does not contain business logic. It does not hold the state of the business objects

We designed and structured our loosely coupled components in a modular way, and that enable us to choose different deployment strategy and take first step towards Microservices architectural style.

Each microservice:

AxonServer & event messages & command messages & query messages

Both AxonFramework and AxonServer form an Axon platform.

The key characteristics of AxonServer are:

AxonServer connector is configured by default :

 <dependency>
     <groupId>org.axonframework</groupId>
     <artifactId>axon-spring-boot-starter</artifactId>
     <version>${axon.version}</version>
 </dependency>

Alternatively, you can exclude AxonServer connector and fallback to JPA event store and storage in general. In that case you have to choose (and configure, and operate) other options (Spring cloud, Kafka, RabbitMQ, …) to distribute your messages. We did this already in other apps (Micorservices1, Microservices2, …) as a proof that you can benefit from AxonFramework programming model only (without AxonServer as an infrastructural component)

<dependency>
    <groupId>org.axonframework</groupId>
    <artifactId>axon-spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-server-connector</artifactId>
        </exclusion>
    </exclusions>
</dependency>

AxonFramework and AxonServer are open source. Axon Server Enterprise is targeted towards mission-critical, medium to large scale production deployments of Axon.

STOMP over WebSockets API

Customer (command side)

WebSocket SockJS endpoint: ws://localhost:8081/customer/websocket

Courier (command side)

WebSocket SockJS endpoint: ws://localhost:8082/courier/websocket

Restaurant (command side)

WebSocket SockJS endpoint: ws://localhost:8084/restaurant/websocket

Order (command side)

WebSocket SockJS endpoint: ws://localhost:8083/order/websocket

Query side

WebSocket SockJS endpoint: ws://localhost:8085/query/websocket

Development

This project is driven using Maven.

Clone

$ git clone https://github.com/idugalic/digital-restaurant

Build

$ cd digital-restaurant
$ mvn clean install

Run microservices

AxonServer is required.

$ cd digital-restaurant/drestaurant-apps/drestaurant-microservices-websockets/drestaurant-microservices-websockets-comand-courier
$ mvn spring-boot:run
$ cd digital-restaurant/drestaurant-apps/drestaurant-microservices-websockets/drestaurant-microservices-websockets-comand-customer
$ mvn spring-boot:run
$ cd digital-restaurant/drestaurant-apps/drestaurant-microservices-websockets/drestaurant-microservices-websockets-comand-restaurant
$ mvn spring-boot:run
$ cd digital-restaurant/drestaurant-apps/drestaurant-microservices-websockets/drestaurant-microservices-websockets-comand-order
$ mvn spring-boot:run
$ cd digital-restaurant/drestaurant-apps/drestaurant-microservices-websockets/drestaurant-microservices-websockets-query
$ mvn spring-boot:run

Infrastructure and Platform (As A Service)