IBM MQ - 查询通道状态
IBM MQ - Inquire channel status
我尝试查询 IBM MQ 的通道状态。
PowerShell 的下一个片段是我尝试这样做的。
但是我对如何获取非活动频道的状态有疑问。
&{
$erroractionpreference='stop'
try{
$mq="${env:programfiles(x86)}\IBM\WebSphere MQ\bin\amqmdnet.dll"
[void][reflection.assembly]::loadfrom($mq)
$mqe=[ibm.wmq.mqenvironment]
$mqe::hostname='localhost'
$mqe::port=1414
$mqe::channel='SYSTEM.DEF.SVRCONN'
$mqc=[ibm.wmq.mqc]
$mqe::properties[$mqc::transport_property]=$mqc::transport_mqseries_managed
$mqe::properties[$mqc::ccsid_property]=$mqc::codeset_utf
$qm=new-object ibm.wmq.mqqueuemanager EKR_33
$ag=new-object ibm.wmq.pcf.pcfmessageagent
$ag.connect($qm)
$cmqcfc=[ibm.wmq.pcf.cmqcfc]
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_names
$rq.addparameter($cmqcfc::mqcach_channel_name,'*')
$chst=@{}
$ag.send($rq)|%{
$_.getstringlistparametervalue($cmqcfc::mqcach_channel_names)|%{
$chst[$_.trim()]='INACTIVE'
}
}
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_status
$rq.addparameter($cmqcfc::mqcach_channel_name,'*')
$st=@{$cmqcfc::mqchs_binding='BINDING'
$cmqcfc::mqchs_inactive='INACTIVE'
$cmqcfc::mqchs_initializing='INITIALIZING'
$cmqcfc::mqchs_paused='PAUSED'
$cmqcfc::mqchs_requesting='REQUESTING'
$cmqcfc::mqchs_retrying='RETRYING'
$cmqcfc::mqchs_running='RUNNING'
$cmqcfc::mqchs_starting='STARTING'
$cmqcfc::mqchs_stopped='STOPPED'
$cmqcfc::mqchs_stopping='STOPPING'}
$ag.send($rq)|%{
$chst[$_.getstringparametervalue($cmqcfc::mqcach_channel_name).trim()]=
$st[$_.getintparametervalue($cmqcfc::mqiach_channel_status)]
}
$chst|ft -a
}finally{
if($ag){$ag.disconnect()}
if($qm){$qm.disconnect()}
}
}
一些技术细节:
OS:Windows Server 2008 R2 标准版
IBM Websphere MQ 版本:7.1.0.5
2 JoshMc:
实际上,片段中没有任何错误。
起初我假设频道处于非活动状态...
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_names
$rq.addparameter($cmqcfc::mqcach_channel_name,'*') $chst=@{} $ag.send($rq)|%{
$_.getstringlistparametervalue($cmqcfc::mqcach_channel_names)|%{
$chst[$_.trim()]='INACTIVE' # My guess
}
}
...然后才去查询他们在现实中的状态
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_status
$rq.addparameter($cmqcfc::mqcach_channel_name,'*')
$ag.send($rq)|%{ # I have never got channels with inactive status through sending the 'mqcmd_inquire_channel_names' message.
$chst[$_.getstringparametervalue($cmqcfc::mqcach_channel_name).trim()]=
$st[$_.getintparametervalue($cmqcfc::mqiach_channel_status)]
不知道对不对
如果一个频道是不活动的,这意味着它没有状态。也就是说,查询频道状态命令不会返回与该频道关联的记录。
换句话说。如果您在查询频道状态命令中没有返回特定频道名称的记录,则这意味着该频道处于非活动状态。
我尝试查询 IBM MQ 的通道状态。 PowerShell 的下一个片段是我尝试这样做的。 但是我对如何获取非活动频道的状态有疑问。
&{
$erroractionpreference='stop'
try{
$mq="${env:programfiles(x86)}\IBM\WebSphere MQ\bin\amqmdnet.dll"
[void][reflection.assembly]::loadfrom($mq)
$mqe=[ibm.wmq.mqenvironment]
$mqe::hostname='localhost'
$mqe::port=1414
$mqe::channel='SYSTEM.DEF.SVRCONN'
$mqc=[ibm.wmq.mqc]
$mqe::properties[$mqc::transport_property]=$mqc::transport_mqseries_managed
$mqe::properties[$mqc::ccsid_property]=$mqc::codeset_utf
$qm=new-object ibm.wmq.mqqueuemanager EKR_33
$ag=new-object ibm.wmq.pcf.pcfmessageagent
$ag.connect($qm)
$cmqcfc=[ibm.wmq.pcf.cmqcfc]
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_names
$rq.addparameter($cmqcfc::mqcach_channel_name,'*')
$chst=@{}
$ag.send($rq)|%{
$_.getstringlistparametervalue($cmqcfc::mqcach_channel_names)|%{
$chst[$_.trim()]='INACTIVE'
}
}
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_status
$rq.addparameter($cmqcfc::mqcach_channel_name,'*')
$st=@{$cmqcfc::mqchs_binding='BINDING'
$cmqcfc::mqchs_inactive='INACTIVE'
$cmqcfc::mqchs_initializing='INITIALIZING'
$cmqcfc::mqchs_paused='PAUSED'
$cmqcfc::mqchs_requesting='REQUESTING'
$cmqcfc::mqchs_retrying='RETRYING'
$cmqcfc::mqchs_running='RUNNING'
$cmqcfc::mqchs_starting='STARTING'
$cmqcfc::mqchs_stopped='STOPPED'
$cmqcfc::mqchs_stopping='STOPPING'}
$ag.send($rq)|%{
$chst[$_.getstringparametervalue($cmqcfc::mqcach_channel_name).trim()]=
$st[$_.getintparametervalue($cmqcfc::mqiach_channel_status)]
}
$chst|ft -a
}finally{
if($ag){$ag.disconnect()}
if($qm){$qm.disconnect()}
}
}
一些技术细节:
OS:Windows Server 2008 R2 标准版
IBM Websphere MQ 版本:7.1.0.5
2 JoshMc:
实际上,片段中没有任何错误。
起初我假设频道处于非活动状态...
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_names
$rq.addparameter($cmqcfc::mqcach_channel_name,'*') $chst=@{} $ag.send($rq)|%{
$_.getstringlistparametervalue($cmqcfc::mqcach_channel_names)|%{
$chst[$_.trim()]='INACTIVE' # My guess
}
}
...然后才去查询他们在现实中的状态
$rq=new-object ibm.wmq.pcf.pcfmessage $cmqcfc::mqcmd_inquire_channel_status
$rq.addparameter($cmqcfc::mqcach_channel_name,'*')
$ag.send($rq)|%{ # I have never got channels with inactive status through sending the 'mqcmd_inquire_channel_names' message.
$chst[$_.getstringparametervalue($cmqcfc::mqcach_channel_name).trim()]=
$st[$_.getintparametervalue($cmqcfc::mqiach_channel_status)]
不知道对不对
如果一个频道是不活动的,这意味着它没有状态。也就是说,查询频道状态命令不会返回与该频道关联的记录。
换句话说。如果您在查询频道状态命令中没有返回特定频道名称的记录,则这意味着该频道处于非活动状态。