TypeScript Express gateway (“MyApp”) that forwards HTTP calls to a Python asyncio ROUTER service (“NumberService”) over ZeroMQ. Used to explore DEALER/ROUTER patterns, concurrent request handling, and cross-language messaging.
- myapp/ – Node.js 20+ service written in TypeScript. Exposes
/healthand/api/number-service/test, then relays test messages to NumberService via ZeroMQ DEALER. - numberService/ – Python 3.12 async worker built with
pyzmq. Listens on a ROUTER socket and returns timestamped responses. - docker-compose.yml – Boots NumberService plus two MyApp instances (
session-1on port 8001 andsession-2on port 8002) to demonstrate concurrent clients. - concurrency_test.py – Async httpx script that verifies both sessions’
/healthendpoints and hammers/api/number-service/testfive times in parallel.
- Node.js 20+
- Python 3.12+
- Docker + Docker Compose (for the container workflow)
make install # sets up Python venv + npm packages
make compose-build-run # rebuilds images and launches all services
python concurrency_test.pyUse make compose-down when you are done.
- Run MyApp locally with CLI flags instead of env vars:
cd myapp npm run dev -- --session-id=session-1 --http-port=8001 --router-endpoint=tcp://127.0.0.1:5555 - Start NumberService directly in another shell:
python numberService/src/main.py --router-endpoint=tcp://127.0.0.1:5555
- Smoke-test the whole path at any time via
python concurrency_test.py; it will fail fast if either service is unreachable or the ZeroMQ hop is unhealthy.
The HTTP surface intentionally stays small (health check + test endpoint) so you can focus on ZeroMQ behavior, CLI-driven configs, and multi-instance orchestration.