rmq-dynamic-clients

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2022 License: MIT

README

RMQ dynamic clients

The project represents the configuration and setup server with multiple (scalable) clients which communicate using RPC (Gob codec) over AMQP

CI GoReport license GoDoc

Prerequisites

  • Git
  • Docker
  • Docker Compose

How to Install

Clone from github and navigate to the project's folder

# HTTPS
git clone https://github.com/vbetsun/rmq-dynamic-clients.git

# SSH
git clone [email protected]:vbetsun/rmq-dynamic-clients.git

cd rmq-dynamic-clients

How to Deploy

cp .env.sample .env

change env variables for your needs

DOCS_PORT=8080 # port for serving rpc documentation
AMQP_SERVER_URL=amqp://guest:guest@message-broker:5672 # RabbitMQ url
AMQP_QUEUE_NAME=queue_name # name of queue for usage

and start the application via docker-compose. It should start 1 instance of the server, 3 replicas of the client, and 1 instance of documentation service, which you can see on http://localhost:${DOCS_PORT}

docker-compose --env-file .env -f ./deployments/docker-compose.yml up -d

How to Test

first of all, you have to run next command for making sure that everything is ok and status is "UP"

docker-compose --env-file .env -f ./deployments/docker-compose.yml ps -a

in the printed list you will see few clients (eg deployments_client_1, deployments_client_2, deployments_client_3)

docker attach deployments_client_1

# write your command and press ENTER
AddItem abc
AddItem bcd
AddItem cde

GetItem bcd
GetItem qwe

GetAllItems
RemoveItem bcd
GetAllItems

docker attach deployments_client_2
# and repeat previous step

docker attach deployments_client_3
# and repeat previous step

How to scale

if you want to test the application with more than 3 replicas (for example 10), you can use the next command:

docker-compose --env-file .env -f ./deployments/docker-compose.yml up -d --scale client=10
# and repeat testing phase with attaching to the client_NUM
docker attach deployments_client_9
# and repeat testing

Directories

Path Synopsis
cmd
client
Entry point for application's clients
Entry point for application's clients
docs
Entry point for serving AsyncApi documentation https://www.asyncapi.com/
Entry point for serving AsyncApi documentation https://www.asyncapi.com/
server
Entry point for application's server
Entry point for application's server
Package configs provides project configuration structure
Package configs provides project configuration structure
internal
rpc
Package rpc implements all available requests and handler for communication
Package rpc implements all available requests and handler for communication
pkg
ordered
Package ordered contains of ordered map structure and methods
Package ordered contains of ordered map structure and methods

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL