force message buffers to strings before decoding
See Section "Buffer Objects:" in http://kombu.readthedocs.org/en/latest/userguide/serialization.html Conflicts: worker/worker.py
This commit is contained in:
parent
7de5947d37
commit
7c47c360c3
@ -19,6 +19,7 @@
|
||||
import datetime
|
||||
import sys
|
||||
import time
|
||||
import anyjson
|
||||
|
||||
import kombu
|
||||
import kombu.mixins
|
||||
@ -38,6 +39,7 @@ from stacktach import db
|
||||
from stacktach import message_service
|
||||
from stacktach import stacklog
|
||||
from stacktach import views
|
||||
from kombu.serialization import BytesIO, register
|
||||
|
||||
stacklog.set_default_logger_name('worker')
|
||||
|
||||
@ -61,6 +63,13 @@ class Consumer(kombu.mixins.ConsumerMixin):
|
||||
self.topics = topics
|
||||
self.exchange = exchange
|
||||
|
||||
register('bufferjson', self.loads, anyjson.dumps,
|
||||
content_type='application/json',
|
||||
content_encoding='binary')
|
||||
|
||||
def loads(s):
|
||||
return anyjson.loads(BytesIO(s))
|
||||
|
||||
def _create_exchange(self, name, type, exclusive=False, auto_delete=False):
|
||||
return message_service.create_exchange(name, exchange_type=type,
|
||||
exclusive=exclusive,
|
||||
|
Loading…
x
Reference in New Issue
Block a user