| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 1 | |
| tierno | 3054f78 | 2018-04-25 16:59:53 +0200 | [diff] [blame] | 2 | # import asyncio |
| tierno | 5c01261 | 2018-04-19 16:01:59 +0200 | [diff] [blame] | 3 | from http import HTTPStatus |
| 4 | |
| 5 | __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>" |
| 6 | |
| 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 |
| 20 | Exception.__init__(self, "messaging exception " + message) |
| 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 | |
| 34 | def disconnect(self): |
| 35 | pass |
| 36 | |
| 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 |