コード例 #1
0
    def __init__(self, app, host="", port=5672):
        super().__init__()

        self.app = app
        self.host = host
        self.port = port

        self.container = _reactor.Container(MessagingHandler(self))
        self.container.container_id = f"stagger-{self.container.container_id}"

        self.events = _reactor.EventInjector()
        self.container.selectable(self.events)

        self.daemon = True
コード例 #2
0
    def __init__(self, id=None):
        self._proton_object = _reactor.Container(_Handler(self))

        if id is not None:
            self._proton_object.container_id = id

        self._operations = _queue.Queue()
        self._worker_thread = _WorkerThread(self)
        self._lock = _threading.Lock()

        self._event_injector = _reactor.EventInjector()
        self._proton_object.selectable(self._event_injector)

        # proton endpoint => gambit endpoint
        self._endpoints = dict()

        self._connections = set()
コード例 #3
0
    def __init__(self, home_dir, name, handler):
        super(MessagingCommand, self).__init__(home_dir, name)

        self.container = _reactor.Container(handler)

        self.events = _reactor.EventInjector()
        self.container.selectable(self.events)

        self.input_file = _sys.stdin
        self.input_thread = _InputThread(self)
        self.input_messages = _collections.deque()

        self.output_file = _sys.stdout

        self.ready = _threading.Event()
        self.done = _threading.Event()

        self.add_argument("--id", metavar="ID",
                          help="Set the container identity to ID")