| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 1 | |
| tierno | f3a5443 | 2018-03-21 11:34:00 +0100 | [diff] [blame] | 2 | import asyncio |
| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 3 | from http import HTTPStatus |
| 4 | |
| tierno | ae50192 | 2018-02-06 23:17:16 +0100 | [diff] [blame] | 5 | __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>" |
| 6 | |
| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 7 | |
| 8 | class MsgException(Exception): |
| 9 | """ |
| 10 | Base Exception class for all msgXXXX exceptions |
| 11 | """ |
| 12 | |
| 13 | def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR): |
| 14 | """ |
| 15 | General exception |
| 16 | :param message: descriptive text |
| 17 | :param http_code: <http.HTTPStatus> type. It contains ".value" (http error code) and ".name" (http error name |
| 18 | """ |
| 19 | self.http_code = http_code |
| tierno | ae50192 | 2018-02-06 23:17:16 +0100 | [diff] [blame] | 20 | Exception.__init__(self, "messaging exception " + message) |
| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 21 | |
| 22 | |
| 23 | class MsgBase(object): |
| 24 | """ |
| 25 | Base class for all msgXXXX classes |
| 26 | """ |
| 27 | |
| 28 | def __init__(self): |
| 29 | pass |
| 30 | |
| 31 | def connect(self, config): |
| 32 | pass |
| 33 | |
| tierno | 0aef0db | 2018-02-01 19:13:07 +0100 | [diff] [blame] | 34 | def disconnect(self): |
| 35 | pass |
| 36 | |
| tierno | f3a5443 | 2018-03-21 11:34:00 +0100 | [diff] [blame] | 37 | def write(self, topic, key, msg): |
| 38 | pass |
| 39 | |
| 40 | def read(self, topic): |
| 41 | pass |
| 42 | |
| 43 | async def aiowrite(self, topic, key, msg, loop): |
| 44 | pass |
| 45 | |
| 46 | async def aioread(self, topic, loop): |
| 47 | pass |