# rabbitmq
## rabbitmq vs kafka
^ [[RabbitMQ]] ^ [[Kafka]] ^
| Variation of [[Pub-Sub]], [[Request-Response]] & [[Point-to-Point]] patterns. | [[Pub-Sub]] for streaming platforms |
| Smartk Broker Model | Smart Consumer Model |
| Can ba synchronous/asynchronous | Durable message store |
| Push based approach | Pull based approach |
| Prioritize messages | Order/Retain/Guarantee messages |
| Decoupled consumer queues | Coupled consumer partition/groups |
^ Use RabbitMQ when ^ Use Kafka when ^
| No event replay | Replay |
| No clear picture of [[E2E]] architecture | Streaming |
| No producer changes for consumer additions | High throughput |
| Language agnostic microservices architecture | |
### Limitations
^ RabbitMQ ^ Kafak ^
| Queues are single threaded | Storage overheads |
| Compllex with more brokers | Streaming API for specific languages |
| No events replay | Ordering per partition |
| No native streaming support | Needs producer coordination with consumer for partition increases |
## docker
docker run -d -p 5672:5672 rabbitmq
### docker-compose
version: '3'
services:
rabbitmq:
image: 'rabbitmq:3-management-alpine'
container_name: rabbitmq-stream
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_ERLANG_COOKIE: "RabbitMQ-My-Cookies"
RABBITMQ_DEFAULT_USER: "admin"
RABBITMQ_DEFAULT_PASS: "admin"
## Docs
- [[pyrabbit]]