gpt4 book ai didi

java - 是否可以仅获取本地队列和别名队列的队列名称?

转载 作者:行者123 更新时间:2023-12-01 08:11:10 25 4
gpt4 key购买 nike

我目前正在获取如下所示的所有队列名称:

PCFAgent agent = new PCFAgent(this.HostName, this.Port, this.CHANNEL_NAME);
PCFParameter[] parameters = { new MQCFST(CMQC.MQCA_Q_NAME, "*"), new MQCFIN (CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL) };
MQMessage[] responses = agent.send(CMQCFC.MQCMD_INQUIRE_Q_NAMES, parameters);
MQCFH cfh = new MQCFH(responses[0]);

但是我也得到了远程队列,有没有办法只检索本地和别名队列名称?

最佳答案

另一种方法是获取所有队列并简单地选择您想要的类型,而不是执行 2 个 PCF 请求。

PCFAgent agent = new PCFAgent(this.HostName, this.Port, this.CHANNEL_NAME);
PCFParameter[] parameters = { new MQCFST(CMQC.MQCA_Q_NAME, "*"), new MQCFIN (CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL) };
MQMessage[] responses = agent.send(CMQCFC.MQCMD_INQUIRE_Q_NAMES, parameters);

for (int i = 0; i < responses.length; i++)
{
// Make sure that each response is ok
if ((responses[i]).getCompCode() == MQException.MQCC_OK)
{
type = responses[i].getIntParameterValue(CMQC.MQIA_Q_TYPE);

switch (type)
{
case CMQC.MQQT_LOCAL:
// do something with local queue
break;
case CMQC.MQQT_MODEL:
// skip model queue
break;
case CMQC.MQQT_ALIAS:
// do something with alias queue
break;
case CMQC.MQQT_REMOTE:
// skip remote queue
break;
case CMQC.MQQT_CLUSTER:
// skip cluster queue
break;
default :
// something unexpected
break;
}
}
}

关于java - 是否可以仅获取本地队列和别名队列的队列名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17200789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com