def _create_channel(self, timeout=None): future = self._create_future(timeout=timeout) self._channel_maker(future.set_result) channel = yield from future # type: pika.channel.Channel channel.confirm_delivery(self._on_delivery_confirmation) channel.add_on_close_callback(self._on_channel_close) channel.add_on_return_callback(self._on_return) return channel
def initialize(self, timeout=None) -> None: if self._closing.done(): raise RuntimeError("Can't initialize closed channel") future = self._create_future(timeout=timeout) self.__connection._connection.channel(future.set_result) channel = yield from future # type: pika.channel.Channel channel.confirm_delivery(self._on_delivery_confirmation) channel.add_on_close_callback(self._on_channel_close) self.__channel = channel
def _create_channel(self, timeout=None): future = self._create_future(timeout=timeout) self._channel_maker(future.set_result, channel_number=self._channel_number) channel = yield from future # type: pika.channel.Channel if self._publisher_confirms: channel.confirm_delivery(self._on_delivery_confirmation) if self._on_return_raises: channel.add_on_return_callback(self._on_return_delivery) channel.add_on_close_callback(self._on_channel_close) channel.add_on_return_callback(self._on_return) return channel