-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from ayeshLK/dev
Add online food-ordering system sample
- Loading branch information
Showing
32 changed files
with
1,889 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# EzFood: Online Food Ordering Platform | ||
|
||
[![Star on Github](https://img.shields.io/badge/-Star%20on%20Github-blue?style=social&logo=github)](https://github.com/ballerina-platform/module-ballerinax-java.jms) | ||
|
||
_Authors_: @ayeshLK \ | ||
_Reviewers_: @NipunaRanasinghe \ | ||
_Created_: 2024/01/26 \ | ||
_Updated_: 2024/01/26 | ||
|
||
## Overview | ||
|
||
EzFood is an online food ordering platform designed to simplify the process of placing and processing food orders. The system consists of three main components: Order Service, Order Processor, and Menu Service. | ||
|
||
1. **Order Service:** | ||
- Provides REST API capabilities for customers to place orders, view order status, and complete payments. | ||
- Manages the overall order lifecycle, from order placement to completion or cancellation. | ||
|
||
2. **Order Processor:** | ||
- Backend service responsible for processing order information. | ||
- Calculates the total price for orders and estimates the time of completion. | ||
- Communicates with the Order Service using JMS queues to exchange order details and confirmations. | ||
|
||
3. **Menu Service:** | ||
- Manages the menu of the food items available for ordering. | ||
- Provides API endpoints for retrieving the entire menu and details for specific items. | ||
|
||
This application is written using the [Ballerina](https://ballerina.io/) programming language. Ballerina `java.jms` package is used for JMS integration. | ||
|
||
### System Architecture | ||
|
||
The EzFood system follows a microservices architecture, with distinct components handling specific functionalities. The communication between services is facilitated by Java Message Service (JMS), ensuring a reliable and asynchronous messaging pattern. | ||
|
||
| ![system-components.png](./ezfood.png) | | ||
|:--------------------------------------------------------------------------------:| | ||
| *Image 1: System components* | | ||
|
||
## Deploying the system | ||
|
||
### Starting Menu Service | ||
|
||
Go into the `menu-svc` directory and execute the following command: | ||
|
||
```sh | ||
bal run | ||
``` | ||
|
||
### Starting Order Service | ||
|
||
Go into the `order-svc` directory and execute the following command: | ||
|
||
```sh | ||
bal run | ||
``` | ||
|
||
### Starting the Order Processor | ||
|
||
Go into the `order-processor` directory and execute the following command: | ||
|
||
```sh | ||
bal run | ||
``` | ||
|
||
### Deploying the system in docker | ||
|
||
1. Execute `build-docker-images.sh` script. | ||
|
||
```sh | ||
sh build-docker-images.sh | ||
``` | ||
|
||
2. Run the following command. | ||
|
||
```sh | ||
docker compose up | ||
``` | ||
|
||
## Test the system | ||
|
||
- Install VSCode [REST client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) plugin. | ||
- Open the `online-food-delivery-request.http` from the VSCode and execute the requests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2024 WSO2 LLC. (http://wso2.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
( cd menu-svc ; bal clean ; bal build --cloud=docker) | ||
( cd order-processor ; bal clean ; bal build --cloud=docker) | ||
( cd order-svc ; bal clean ; bal build --cloud=docker) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
version: '2' | ||
|
||
services: | ||
order-svc: | ||
image: 'ballerina/ordersvc:1.0.0' | ||
ports: | ||
- '9091:9091' | ||
depends_on: | ||
order-processor: | ||
condition: service_started | ||
activemq: | ||
condition: service_healthy | ||
network_mode: "host" | ||
|
||
order-processor: | ||
image: 'ballerina/orderprocessor:1.0.0' | ||
depends_on: | ||
menu-svc: | ||
condition: service_started | ||
activemq: | ||
condition: service_healthy | ||
network_mode: "host" | ||
|
||
menu-svc: | ||
image: 'ballerina/menusvc:1.0.0' | ||
ports: | ||
- '9090:9090' | ||
network_mode: "host" | ||
|
||
activemq: | ||
image: 'apache/activemq-classic:6.0.0' | ||
container_name: activemq-test-server | ||
ports: | ||
- '61616:61616' | ||
- '8161:8161' | ||
network_mode: "host" | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl -u admin:admin http://localhost:8161/admin"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 3 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
org = "example" | ||
name = "menusvc" | ||
version = "0.1.0" | ||
|
||
[build-options] | ||
observabilityIncluded = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[container.image] | ||
repository="ballerina" | ||
name="menusvc" | ||
tag="1.0.0" | ||
|
||
[[container.copy.files]] | ||
sourceFile="./Config.toml" | ||
target="/home/ballerina/Config.toml" | ||
|
||
[[cloud.config.files]] | ||
file="./Config.toml" |
Oops, something went wrong.