stompman is a modern, asynchronous Python client for the STOMP (Simple Text Oriented Messaging Protocol) messaging protocol. It provides a typed, modern, and comprehensible API for working with STOMP-compatible message brokers like ActiveMQ Artemis and ActiveMQ Classic.
The project consists of two main packages:
stompman- The core STOMP client libraryfaststream-stomp- A FastStream broker implementation for STOMP
- Fully asynchronous implementation using Python's asyncio
- Modern, typed API with comprehensive type hints
- Automatic connection management with reconnection capabilities
- Support for transactions, subscriptions, and message acknowledgment
- Built-in heartbeat support for connection health monitoring
- Integration with FastStream for declarative message handling
- Compatible with STOMP 1.2 protocol specification
- Tested with ActiveMQ Artemis and ActiveMQ Classic
stompman/
├── packages/
│ ├── stompman/ # Core STOMP client library
│ │ ├── stompman/ # Main source code
│ │ └── test_stompman/ # Unit and integration tests
│ └── faststream-stomp/ # FastStream broker implementation
│ ├── faststream_stomp/ # Main source code
│ └── test_faststream_stomp/ # Unit and integration tests
├── examples/ # Usage examples
├── docker-compose.yml # Development environment with ActiveMQ containers
└── Justfile # Project commands and workflows
Client- The main entry point for interacting with STOMP serversConnectionParameters- Configuration for connecting to STOMP serversHeartbeat- Configuration for connection heartbeats
Client.send()- Send messages to destinationsClient.subscribe()- Subscribe to destinations with automatic ACK/NACK handlingClient.subscribe_with_manual_ack()- Subscribe with manual ACK/NACK controlClient.begin()- Start a transaction context managerClient.is_alive()- Check connection health
FailedAllConnectAttemptsError- Raised when all connection attempts failFailedAllWriteAttemptsError- Raised when writes fail after all retries- Various other specific error types for different failure scenarios
Provides a FastStream broker implementation that allows using FastStream's declarative approach with STOMP:
StompBroker- Main broker class- Decorators for subscribers and publishers
- Testing utilities with
TestStompBroker
The project uses Docker Compose to provide a development environment with:
- ActiveMQ Artemis on port 9000
- ActiveMQ Classic on port 9001
- Python 3.11 or newer
- uv (package manager)
- Docker and Docker Compose (for development environment)
# Install dependencies
just install
# Or manually:
uv lock --upgrade
uv sync --all-extras --all-packages --frozen# Run fast tests (unit tests only)
just test-fast
# Run all tests (including integration tests with Docker)
just test
# Run tests with specific arguments
just test-fast -k "test_specific_feature"# Run linters
just lint
# Check types
just check-types
# Format code
uv run ruff format .# Start ActiveMQ Artemis
just run-artemis
# Run consumer example
just run-consumer
# Run producer example
just run-producer- Strict adherence to type hints with mypy in strict mode
- Code formatting with ruff (line length 120)
- Comprehensive unit and integration tests
- Modern Python features (3.11+) encouraged
- Unit tests in
test_stompman/directory - Integration tests that require Docker containers
- Property-based testing with hypothesis
- Test coverage reporting enabled
- Automated testing on multiple platforms
- Type checking and linting in CI pipeline
- Automated publishing to PyPI
-
Adding a new feature:
- Implement in the appropriate module under
stompman/ - Add unit tests in
test_stompman/ - Update documentation in docstrings and README if needed
- Implement in the appropriate module under
-
Fixing a bug:
- Write a failing test that reproduces the issue
- Fix the implementation
- Verify the test now passes
-
Updating dependencies:
- Modify
pyproject.tomlfiles - Run
uv lock --upgradeto update lock files
- Modify
-
Running integration tests:
- Ensure Docker is running
- Run
just testto start containers and run tests