Skills service to use common bus client method
@@ -29,15 +29,13 @@ from mycroft.api import is_paired, BackendDown, DeviceApi
from mycroft.audio import wait_while_speaking
from mycroft.enclosure.api import EnclosureAPI
from mycroft.configuration import Configuration
-from mycroft.messagebus.client import MessageBusClient
from mycroft.messagebus.message import Message
from mycroft.util import (
connected,
- create_echo_function,
- create_daemon,
reset_sigint_handler,
wait_for_exit_signal
)
+from mycroft.services import start_message_bus_client
from mycroft.util.lang import set_active_lang
from mycroft.util.log import LOG
from .core import FallbackSkill
@@ -194,7 +192,7 @@ def main(ready_hook=on_ready, error_hook=on_error, stopping_hook=on_stopping,
set_active_lang(config.get('lang', 'en-us'))
# Connect this process to the Mycroft message bus
- bus = _start_message_bus_client()
+ bus = start_message_bus_client("SKILLS")
_register_intent_services(bus)
event_scheduler = EventScheduler(bus)
skill_manager = _initialize_skill_manager(bus, watchdog)
@@ -215,23 +213,6 @@ def main(ready_hook=on_ready, error_hook=on_error, stopping_hook=on_stopping,
shutdown(skill_manager, event_scheduler)
-def _start_message_bus_client():
- """Start the bus client daemon and wait for connection."""
- bus = MessageBusClient()
- Configuration.set_config_update_handlers(bus)
- bus_connected = Event()
- bus.on('message', create_echo_function('SKILLS'))
- # Set the bus connected event when connection is established
- bus.once('open', bus_connected.set)
- create_daemon(bus.run_forever)
-
- # Wait for connection
- bus_connected.wait()
- LOG.info('Connected to messagebus')
-
- return bus
-
-
def _register_intent_services(bus):
"""Start up the all intent services and connect them as needed.
