Add AMQP websocket
This commit is contained in:
parent
752d21b500
commit
c459226604
2 changed files with 201 additions and 2 deletions
|
@ -16,7 +16,7 @@ class EventPoster(object):
|
|||
|
||||
def _connect(self):
|
||||
self._conn = pika.BlockingConnection(
|
||||
pika.URLParameters(settings.EVENT_DAEMON_AMQP)
|
||||
pika.URLParameters(settings.EVENT_DAEMON_AMQP),
|
||||
)
|
||||
self._chan = self._conn.channel()
|
||||
|
||||
|
@ -25,7 +25,7 @@ class EventPoster(object):
|
|||
id = int(time() * 1000000)
|
||||
self._chan.basic_publish(
|
||||
self._exchange,
|
||||
"",
|
||||
"#",
|
||||
json.dumps({"id": id, "channel": channel, "message": message}),
|
||||
)
|
||||
return id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue