Creates a new pool of VortexChannel items, that are managed in a way that ensure better throutput relation.
This module was created to allow having a pool of pre-created channels (VortexChannel) to be used over and over again during the application life.
Because channel creation and channel close is an expensive process (especially due to all requirements to be meet during channel close), the channel pool can help to improve greatly your application communication throughput, considering the relation between request/replies received on a selected connection (VortexConnection).
Keep in mind the following facts which may help you to chose using vortex channel pool instead of controlling yourself channels created on a particular connection.
The VortexChannelPool allows you to create a pool of channels and reuse then on next operations, saving starts/close operations, based on the readyness of channels inside the pool.
This notion of "ready to be used" means that the channel have no pending replies to be received so if you application send a message it will receive the reply as soon as possible (vortex_channel_is_ready).
Actually the reply can be really late due to remote peer processing but it will not be delayed by messages previously sent, awaiting for replies.
Once you create a pool you can get its actual size, add or remove channel from the pool or attach new channel that weren't created by this module. In general, we can consider that there are two ways to use the channel pool once created:
In the case that channel creation process is managed by the channel pool, all of them will be created over the given session (connection) and will be created under the semantics defined by profile. The function will block you until all channels are created. During the channel creation process one channel may fail to be created so you should check how many channels have been really created.
You can create several channel pools over the same connection. Every channel pool is identified by an id. This Id can be used to lookup certain channel pool into a given connection.
Once a channel pool is created, it is associated with the given connection so calls to vortex_connection_get_channel_pool over a connection will return the pool created. You can of course hold a reference to your channel pool and avoid using previous function.
The function vortex_channel_pool_get_next_ready will return the next channel ready to be used. But this function may return NULL if no channel is ready to be used. You can optionally set the auto_inc parameter to increase channel pool size to resolve your petition.
Once the channel retreived from the channel pool is no longer required, it is "returned to the channel pool", to be usable by other queries, by calling to vortex_channel_pool_release_channel.
See this section which contains more information about using the channel pool: 3.2 Implementing the request-response pattern.