def run(): logger.debug('service started') service = Service(config_file='config-debug.json', callback=my_example_event_handler).start()
def test_load_driver(self): service = Service(config_file='test/config-test.json', handlers=self.test_load_driver)
def test_load_driver(self): service = Service(config_file='test/config-test.json', callback=self.test_load_driver)
#!/usr/bin/env python """ Minimal viable microservice that publishes events to test how system works """ import logging import sys from eventify.event import Event from eventify.service import Service FORMAT = '%(asctime)-15s %(name)s %(levelname)s %(message)s' logging.basicConfig(stream=sys.stdout, format=FORMAT, level=logging.DEBUG) logger = logging.getLogger('event.producer') async def display_stats(session): # show all session data await session.show_sessions() # show total sessions await session.total_sessions() # lookup session await session.lookup_session('example') if __name__ == '__main__': service = Service(config_file='config-manage.json', callback=display_stats) service.start_producer()
def run(): """ Run an eventify service """ Service(config_file='config.json', handlers=[Collector]).start()
import time from eventify.event import Event from eventify.service import Service FORMAT = '%(asctime)-15s %(name)s %(levelname)s %(message)s' logging.basicConfig(stream=sys.stdout, format=FORMAT, level=logging.DEBUG) logger = logging.getLogger('event.producer') async def produce_events(session): """ Produces 10 events """ print('called') logger.debug('called') counter = 1 for number in range(1,11): print(counter) event = Event({ "name": "EventProduced", "message": "Event %s" % number }) await session.emit_event(event) counter = counter + 1 if __name__ == '__main__': service = Service(config_file='config-producer.json', callback=produce_events) service.start_producer()