Metadata-Version: 2.1
Name: gabby
Version: 0.0.4
Summary: A simple controller for message queue pipelines
Home-page: https://github.com/luanguimaraesla/gabby
Author: Luan Guimarães Lacerda
Author-email: luan@live.in
License: MIT License
Keywords: iot,mosquitto,mqtt,message,queue,pipeline,multiprocessing
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries
Provides-Extra: dev
Provides-Extra: docs
Requires-Dist: paho-mqtt
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: coverage; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: bumpversion; extra == 'dev'
Provides-Extra: docs
Requires-Dist: docutils; extra == 'docs'
Requires-Dist: sphinx-autobuild; extra == 'docs'


<a href="https://codeclimate.com/github/luanguimaraesla/gabby/maintainability">
    <img src="https://api.codeclimate.com/v1/badges/dc94cbf3854b542d3862/maintainability" />
</a>
<a href="https://travis-ci.org/luanguimaraesla/gabby">
    <img src="https://travis-ci.org/luanguimaraesla/gabby.svg?branch=master" />
</a>
<a href="https://badge.fury.io/py/gabby">
    <img src="https://badge.fury.io/py/gabby.svg" />
</a>
<a href="https://codecov.io/gh/codecov/example-python">
    <img src="https://codecov.io/gh/luanguimaraesla/gabby/branch/master/graph/badge.svg" />
</a>


# Python Gabby

A simple controller for message queue pipelines using Mosquitto

## Installing

You can install the package through pip

```bash
pip install gabby
```

## Examples

Before run examples, please initialize the Mosquitto server.

#### Receiving messages

```python
from gabby.gabby import Gabby, Topic
from gabby.controller import Controller


class PrinterGabby(Gabby):
    def transform(self, message):
        print(f'ARRIVED! Data: {message.data}')
        return []


if __name__ == "__main__":
    controller = Controller()

    topic_A = Topic('queue/a', 'i')
    topic_B = Topic('queue/b', 'i')

    printer_gabby = PrinterGabby([topic_A], [topic_B])

    controller.add_gabby(printer_gabby)
    controller.run()
```

#### Transmitting messages

```python
from gabby.gabby import Gabby, Topic
from gabby.message import Message


if __name__ == "__main__":
    topic_A = Topic('queue/a', 'i')
    topic_B = Topic('queue/b', 'i')

    g = Gabby([topic_B], [topic_A])
    data = (1,)
    g.send(Message(data, g.output_topics))

```


