Made Redis bus/local bus choice more flexible
This commit is contained in:
parent
400a6fc718
commit
13463420d9
1 changed files with 7 additions and 1 deletions
|
@ -12,6 +12,7 @@ import traceback
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
|
from .bus import Bus
|
||||||
from .bus.redis import RedisBus
|
from .bus.redis import RedisBus
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .context import register_backends
|
from .context import register_backends
|
||||||
|
@ -120,7 +121,12 @@ class Daemon:
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
""" Start the daemon """
|
""" Start the daemon """
|
||||||
self.bus = RedisBus(on_message=self.on_message())
|
redis_conf = Config.get('backend.redis')
|
||||||
|
if redis_conf:
|
||||||
|
self.bus = RedisBus(on_message=self.on_message(),
|
||||||
|
**redis_conf.get('redis_args', {}))
|
||||||
|
else:
|
||||||
|
self.bus = Bus(on_message=self.on_message())
|
||||||
|
|
||||||
# Initialize the backends and link them to the bus
|
# Initialize the backends and link them to the bus
|
||||||
self.backends = register_backends(bus=self.bus, global_scope=True)
|
self.backends = register_backends(bus=self.bus, global_scope=True)
|
||||||
|
|
Loading…
Reference in a new issue