MCPcopy
hub / github.com/pika/pika / channel

Method channel

pika/connection.py:1281–1312  ·  view source on GitHub ↗

Create a new channel with the next available channel number or pass in a channel number to use. Must be non-zero if you would like to specify but it is recommended that you let Pika manage the channel numbers. :param int channel_number: The channel number to use, def

(
            self,
            channel_number: Optional[int] = None,
            on_open_callback: Optional[Callable[[Channel],
                                                Any]] = None)

Source from the content-addressed store, hash-verified

1279 self.callbacks.add(0, self.ON_CONNECTION_ERROR, callback, False)
1280
1281 def channel(
1282 self,
1283 channel_number: Optional[int] = None,
1284 on_open_callback: Optional[Callable[[Channel],
1285 Any]] = None) -> Channel:
1286 """Create a new channel with the next available channel number or pass
1287 in a channel number to use. Must be non-zero if you would like to
1288 specify but it is recommended that you let Pika manage the channel
1289 numbers.
1290
1291 :param int channel_number: The channel number to use, defaults to the
1292 next available.
1293 :param callable on_open_callback: The callback when the channel is
1294 opened. The callback will be invoked with the `Channel` instance
1295 as its only argument.
1296 :rtype: pika.channel.Channel
1297
1298 """
1299 if not self.is_open:
1300 raise exceptions.ConnectionWrongStateError(
1301 'Channel allocation requires an open connection: %s' % self)
1302
1303 validators.rpc_completion_callback(on_open_callback)
1304
1305 if not channel_number:
1306 channel_number = self._next_channel_number()
1307
1308 self._channels[channel_number] = self._create_channel(
1309 channel_number, on_open_callback)
1310 self._add_channel_callbacks(channel_number)
1311 self._channels[channel_number].open()
1312 return self._channels[channel_number]
1313
1314 def update_secret(
1315 self,

Calls 4

_next_channel_numberMethod · 0.95
_create_channelMethod · 0.95
openMethod · 0.45