Пример #1
0
def main(cluster, configuration, set):
    configuration = yaml.load(configuration)
    with cluster:
        target = configure(configuration['target'])(cluster, set)
        loader = configure(configuration['loader'])(cluster, set)
        stream = configure(configuration['stream'])(cluster, set)
        target.run(loader, stream)
Пример #2
0
def main(cluster, consumer_id, configuration, set):
    configuration = yaml.load(configuration)
    with cluster:
        stream = configure(configuration['stream'])(cluster, set)

        relay = Relay(cluster, set, consumer_id, stream)
        relay.start()

        def __request_exit(signal, frame):
            relay.stop_async()

        signal.signal(signal.SIGINT, __request_exit)
        signal.signal(signal.SIGTERM, __request_exit)

        while True:
            relay.join(0.1)
            if not relay.is_alive():
                relay.result()
                break