This project consists of two microservices:
- A Go client using the standard
net/rpclibrary - A Python server implementing a compatible RPC interface
The primary functionality is a time service where the client makes a single request, and the server responds with a stream of time updates.
.
├── client/ # Go client service
│ ├── go.mod # Go module definition
│ └── main.go # Client implementation
├── server/ # Python server service
│ ├── pyproject.toml # Poetry configuration
│ └── time_service/ # Python package
│ ├── __init__.py
│ ├── main.py # Server entry point
│ └── service.py # Time service implementation
└── specs.md # Project specifications
- Go 1.21 or later
- Python 3.9 or later
- Poetry (Python dependency management)
-
Navigate to the client directory:
cd client -
Build the client:
go build -o time-client
-
Navigate to the server directory:
cd server -
Install dependencies using Poetry:
# Install Poetry if not already installed curl -sSL https://install.python-poetry.org | python3 - # Install dependencies poetry install
-
Navigate to the server directory:
cd server -
Run the server using Poetry:
poetry run python -m time_service.main
Optional arguments:
--host: Host to bind the server to (default: localhost)--port: Port to bind the server to (default: 8080)
-
Navigate to the client directory:
cd client -
Run the client:
./time-client
Optional flags:
-server: RPC server address (default: localhost:8080)-interval: Update interval in seconds (default: 1)-duration: Total duration in seconds, 0 for indefinite (default: 60)
-
Start the server in one terminal:
cd server poetry run python -m time_service.main -
Run the client in another terminal:
cd client ./time-client -interval 2 -duration 30This will request time updates every 2 seconds for a total duration of 30 seconds.
cd server
docker build -t time-service-server .
docker run -p 8080:8080 time-service-servercd client
docker build -t time-service-client .
docker run --network="host" time-service-clientThis project is open source and available under the MIT License.