VortexChannelPool * vortex_xml_rpc_create_channel_pool ( VortexConnection connection,
const char *  serverName,
const char *  resourceName,
VortexOnChannelPoolCreated  on_pool_created,
axlPointer  user_data 
)

Allows to create and attach a channel pool containing XML-RPC channels that are created using the provided serverName and resourceName value.

An efficient alternative to create a XML-RPC channel (vortex_xml_rpc_boot_channel), perform the invocation (vortex_xml_rpc_invoke), and then release the channel (automatically done by the invocation API) is to use a channel pool.

The channel pool maintains a set of channels available to be used, and them are reused across invocations. In the case more channels are required, the channel pool automatically negotiate them for you.

The idea is to create a channel pool (you can create several channel pools on the channel connection) using the function, making all channels inside the pool created to use the serverName and the resourceName value provided.

1 void create_pool () {
2  VortexChannelPool * pool;
3 
4  // create a pool that uses as resource "/API/v1.0"
5  pool = vortex_xml_rpc_create_channel_pool (connection,
6  // no server name value
7  NULL,
8  // resource value
9  "/API/v1.0",
10  // no pool creation notify
11  NULL, NULL);
12 }

Later in your code, if you require a XML-RPC channel to perform an invocation, you get it from the channel pool:

1 void invoke (XmlRpcMethodCall * invocator) {
2  VortexChannel * channel;
3  XmlRpcMethodResponse * response;
4 
5  // get a channel (creating it if not available, using default pool: 1)
6  channel = vortex_xml_rpc_channel_pool_get_next (connection, axl_true, 1);
7 
8  // now perform the invocation
9  response = vortex_xml_rpc_invoke_sync (channel, invocator);
10 
11  // some something with the reply
12 
13  // the channel is not required to be released by calling to
14  // vortex_channel_pool_release_channel because it is already done
15  // by the invocation API: vortex_xml_rpc_invoke (_sync)
16 }
Parameters
connectionThe connection where the channel pool is created.
serverNameThe serverName value to be used while creating more channels in the pool.
resourceNameThe resource value to be used while creating more channel in the pool.
on_pool_createdThe channel pool created notification. See handler documentation. If the handler is provided, the function will return NULL and the channel pool reference created will be received at the handler notification.
user_dataUser defined data to be passed in to the on_pool_created handler.
Returns
A newly created VortexChannelPool or NULL if it fails or a channel pool created notification was received.

References vortex_channel_pool_get_id(), vortex_channel_pool_new_full(), vortex_connection_set_data_full(), and VORTEX_XML_RPC_PROFILE.