# Ensuring message delivery with the mandatory flag

The following example demonstrates how to check if a message is delivered by setting the mandatory flag and handling exceptions when using the BlockingConnection:

```python
--8<-- "examples/blocking_publish_mandatory.py"
```
