更新开始

cciGetBrokerInfo

此函数查询当前的代理环境(例如,获取有关代理名、执行组名和队列管理器名的信息)。以 CCI_BROKER_INFO_ST 类型的结构返回信息。
注: 这不同于现有的 cniGetBrokerInfo,区别在于它不需要提供 CciNode* 句柄,而且 cciGetBrokerInfo 不返回关于消息流的任何信息。因此,可以从初始化函数(例如,bipInitializeUserExitsbipGetMessageParserFactorybipGetMessageFlowNodeFactory)调用 cciGetBrokerInfo

语法

void cciGetBrokerInfo(
int* returnCode,
CCI_BROKER_INFO_ST* broker_info_st);

参数

returnCode(输出)
接收来自函数(输出)的返回码。
可能的返回码是:
  • CCI_SUCCESS
  • CCI_INV_BROKER_INFO_ST
  • CCI_EXCEPTION
broker_info_st(输出)
CCI_BROKER_INFO_ST 结构的地址,成功完成时将用相关的值来填充该结构。

返回值

无。如果发生错误,则 returnCode 参数表明错误原因。

示例

int rc = CCI_SUCCESS;
CCI_BROKER_INFO_ST brokerInfo = {CCI_BROKER_INFO_ST_DEFAULT};
#define INTITIAL_STR_LEN 256
CciChar brokerNameStr[INTITIAL_STR_LEN];
CciChar executionGroupNameStr[INTITIAL_STR_LEN];
CciChar queueManagerNameStr[INTITIAL_STR_LEN];
brokerInfo.brokerName.bufferLength = INTITIAL_STR_LEN;
brokerInfo.brokerName.buffer = brokerNameStr;
brokerInfo.executionGroupName.bufferLength = INTITIAL_STR_LEN;
brokerInfo.executionGroupName.buffer = executionGroupNameStr;
brokerInfo.queueManagerName.bufferLength = INTITIAL_STR_LEN;
brokerInfo.queueManagerName.buffer = queueManagerNameStr;
cciGetBrokerInfo(&rc,&brokerInfo);
/* just in case any of the buffers were too short*/
if ((brokerInfo.brokerName.bytesOutput < brokerInfo.brokerName.dataLength) ||
(brokerInfo.executionGroupName.bytesOutput < brokerInfo.executionGroupName.dataLength) ||
(brokerInfo.queueManagerName.bytesOutput < brokerInfo.queueManagerName.dataLength)) {
/*at least one of the buffer were too short, need to rerty*/
/* NOTE this is unlikely given that the initial sizes were reasonably large*/
brokerInfo.brokerName.bufferLength =
brokerInfo.brokerName.dataLength;
brokerInfo.brokerName.buffer =
(CciChar*)malloc (brokerInfo.brokerName.bufferLength * sizeof(CciChar));
brokerInfo.executionGroupName.bufferLength =
brokerInfo.executionGroupName.dataLength;
brokerInfo.executionGroupName.buffer =
(CciChar*)malloc (brokerInfo.executionGroupName.bufferLength * sizeof(CciChar));
brokerInfo.queueManagerName.bufferLength =
brokerInfo.queueManagerName.dataLength;
brokerInfo.queueManagerName.buffer =
(CciChar*)malloc (brokerInfo.queueManagerName.bufferLength * sizeof(CciChar));
cciGetBrokerInfo(&rc,&brokerInfo);
/*now do something sensible with these strings before the buffers go out of scope*/
/* for example call a user written function to copy them away*/
copyBrokerInfo(brokerInfo.brokerName.buffer,
brokerInfo.executionGroupName.buffer,
brokerInfo.queueManagerName.buffer);
free((void*)brokerInfo.brokerName.buffer);
free((void*)brokerInfo.executionGroupName.buffer);
free((void*)brokerInfo.queueManagerName.buffer);
}else{
/*now do something sensible with these strings before the buffers go out of scope*/
/* for example call a user written function to copy them away*/
copyBrokerInfo(brokerInfo.brokerName.buffer,
brokerInfo.executionGroupName.buffer,
brokerInfo.queueManagerName.buffer);
}
相关概念
建立用户出口
相关任务
建立用户出口
声明 | 商标 | 下载 | | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后更新:2006/05/19
as36040_


更新结束