# Publish/subscribe

Connect independent publishers and subscribers through topics and message queues.

## Get started

Publishers send messages to topics, subscribers consume them through queues, and neither side depends on the other - the pattern, the vocabulary and when to use it.

[What is publish/subscribe?](https://zato.io/docs/eda/intro/pubsub.html)

service.py

```
# Publish a message to a topic
result = self.publish('orders.created',
    order_id=123, status='pending')
result.msg_id
'zpsm.20251011-171049-9451-66b0c25a...'

# Subscribers receive it as their request
event = self.request.input
event['order_id']
123
```

## Concepts

[What is publish/subscribe? Topics, queues, publishers and subscribers, and how pub/sub differs from point-to-point calls.](https://zato.io/docs/eda/intro/pubsub.html) [Message flow The path of a message from a publisher through a topic to each subscriber's queue.](https://zato.io/docs/eda/flow/index.html) [Messages What a message contains - payload, priority, expiration and correlation.](https://zato.io/docs/eda/flow/messages/index.html)

## Endpoints

[Publishers Publish messages to topics from services and external applications.](https://zato.io/docs/eda/endpoint/publisher/index.html) [Subscribers Consume messages through queues, in push and pull deliveries.](https://zato.io/docs/eda/endpoint/subscriber/index.html)

## APIs

[REST API Publish and receive messages over REST from any technology.](https://zato.io/docs/eda/api/rest.html) [Python API Publish and subscribe from services with self.pubsub.](https://zato.io/docs/eda/api/python/index.html)

## Security

[Pub/sub security Who may publish and who may subscribe to each topic.](https://zato.io/docs/eda/security/index.html)
