3 from http
import HTTPStatus
5 __author__
= "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
8 class MsgException(Exception):
10 Base Exception class for all msgXXXX exceptions
13 def __init__(self
, message
, http_code
=HTTPStatus
.INTERNAL_SERVER_ERROR
):
16 :param message: descriptive text
17 :param http_code: <http.HTTPStatus> type. It contains ".value" (http error code) and ".name" (http error name
19 self
.http_code
= http_code
20 Exception.__init
__(self
, "messaging exception " + message
)
23 class MsgBase(object):
25 Base class for all msgXXXX classes
31 def connect(self
, config
):
37 def write(self
, topic
, key
, msg
):
40 def read(self
, topic
):
43 async def aiowrite(self
, topic
, key
, msg
, loop
):
46 async def aioread(self
, topic
, loop
):