Metadata-Version: 2.4
Name: fp-mqtt-broker
Version: 0.1.2
Summary: A flexible MQTT broker package for IoT services with optional message handlers
Home-page: https://github.com/RodCaba/fp-mqtt-broker
Author: Rodrigo
Author-email: rodser4@gmail.com
Project-URL: Bug Tracker, https://github.com/RodCaba/fp-mqtt-broker/issues
Project-URL: Documentation, https://github.com/RodCaba/fp-mqtt-broker#readme
Project-URL: Source, https://github.com/RodCaba/fp-mqtt-broker
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: paho-mqtt==1.6.1
Provides-Extra: dev
Requires-Dist: pytest==8.4.1; extra == "dev"
Requires-Dist: pytest-mock==3.14.1; extra == "dev"
Requires-Dist: coverage==7.9.1; extra == "dev"
Requires-Dist: pytest-cov==6.2.1; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# FP MQTT Broker Package

A flexible MQTT broker package for IoT services that supports optional message handlers, allowing different services to subscribe and handle MQTT messages independently.

## Features

- **Flexible Message Handling**: Support for multiple, optional message handlers
- **Easy Configuration**: Simple configuration through dictionaries or BrokerConfig objects
- **Extensible**: Abstract interfaces for easy customization
- **Production Ready**: Built-in error handling, reconnection logic, and logging

## Installation

```bash
pip install -e .
```

## Usage

```python
from fp_mqtt_broker import BrokerFactory
from fp_mqtt_broker.abstractions import MessageHandler

config = {
    'mqtt': {
        'broker_host': 'localhost',
        'broker_port': 1883,
        'client_id': 'my_service'
    }
}

# Define a custom message handler
class MyMessageHandler(MessageHandler):
    def get_subscribed_topics(self) -> list:
        return ['my/topic']

    def handle_message(self, topic: str, payload: str):
        print(f"Received message on {topic}: {payload}")

# Create and connect the broker with the custom message handler
broker = BrokerFactory.create_broker(config, [MyMessageHandler()])
broker.connect()
```

## Testing

```bash
pytest -v
```
