Metadata-Version: 2.1
Name: bordercontrol
Version: 0.2.0.0.4
Summary: NATS wrapper for fast scanner development
Home-page: UNKNOWN
Author: Gleb Lysov
Author-email: lysov.g.v@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3.5
Description-Content-Type: text/markdown
Requires-Dist: asyncio-nats-client
Requires-Dist: python-dateutil

----------------------------------------------------
Instruction for develop a new module.
----------------------------------------------------

```python
from bc.dev.handlers import WorkerThreadHandler

counter = 0

def worker_function(data):
global counter
counter += 1
print(counter)

return {"results": [1, 2, 3, 45]}


a = WorkerThreadHandler(worker_function=worker_function, name='name', hostname='hostname')
a.run()
```

**data** - here you see all data which send in sheduler in your channel

**{"results": [1, 2, 3, 45]}** - module send to channel `_reporter` as:

```
{
    'task_data': data,
    'result': [1, 2, 3, 45],
    'name': 'name',
    'hostname': 'hostname'
}
```

**worker_function** - required arg
**name** - optional
**hostname** - optional

Module send to channel `_registration`:
```
{
    "name": "name",
    "hostname": "hostname"
}
```

Module must receive from channel `_registration`:
```
{
    'subjects_to_subscribe': ['test'],
    'unique_name': 'test_module1'
}
```

If error will be detected in worker, module send error message to channel `_errors`:
```
{
    'task_data': data,
    'result': "ERROR",
    'name': 'name',
    'hostname': 'hostname'
}
```


