ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportProblem Listing remote Queues

Post new topicReply to topic
Problem Listing remote Queues View previous topic :: View next topic
Author Message
MillsPerry
PostPosted: Fri Dec 21, 2001 1:16 pm Post subject: Reply with quote

Acolyte

Joined: 08 Oct 2001
Posts: 59
Location: ZyQuest, inc.

I recently figured out how to list a queue manager's local queues by using MQAI. I would like to also list remote queues.

I tried the obvious things, such as changing the MQQT_LOCAL parameter to MQQT_REMOTE, but I just get a blank list returned to me. Can anybody tell me the steps to get a list of remote queues? I'm writing in VB, but I can usually figure out a C++ listing.

Here is my current code. Any unresolved constants are defined in IBM's MQSeries header files.

Public Property Let ConnectionHandle(ByVal vData As Long)
Dim adminBag As Long ' Admin bag handle.
Dim systemBag As Long ' System bag handle.
Dim responseBag As Long ' Response bag handle.
Dim intCompCode As Long, intReason As Long
Dim i As Long
Dim strQName As String * MQ_Q_NAME_LENGTH, intQNameLength As Long

' ============================================================
' Update the property value.
' ============================================================
mvarConnectionHandle = vData

' ============================================================
' Get the queue name list.
' ============================================================
adminBag = MQHB_UNUSABLE_HBAG
systemBag = MQHB_UNUSABLE_HBAG
responseBag = MQHB_UNUSABLE_HBAG

' Create an admin bag.
mqCreateBag MQCBO_ADMIN_BAG, adminBag, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqCreateBag failure on admin bag."
Exit Property
End If

' Create a response bag.
mqCreateBag MQCBO_ADMIN_BAG, responseBag, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqCreateBag failure on response bag."
Exit Property
End If

' Put generic local queue name into admin bag.
mqAddString adminBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, "*", mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqAddString failure."
Exit Property
End If

' Put local queue type into admin bag.
mqAddInteger adminBag, MQIA_Q_TYPE, MQQT_LOCAL, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqAddInteger failure."
Exit Property
End If

' ' ==============================================================================
' ' Put generic remote queue name into admin bag.
' mqAddString adminBag, MQCA_REMOTE_Q_NAME, MQBL_NULL_TERMINATED, "*", mvarCompletionCode, mvarReasonCode
' If mvarCompletionCode = MQCC_FAILED Then
' mvarErrorMessage = "mqAddString failure."
' Exit Property
' End If
'
' ' Put remote queue type into admin bag.
' mqAddInteger adminBag, MQIA_Q_TYPE, MQQT_REMOTE, mvarCompletionCode, mvarReasonCode
' If mvarCompletionCode = MQCC_FAILED Then
' mvarErrorMessage = "mqAddInteger failure."
' Exit Property
' End If
'
' ' ==============================================================================

' Add inquiry for current queue depths.
mqAddInquiry adminBag, MQIA_CURRENT_Q_DEPTH, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqAddInquiry failure."
Exit Property
End If

' Send command to the queue manager.
mqExecute mvarConnectionHandle, MQCMD_INQUIRE_Q, MQHB_NONE, adminBag, responseBag, MQHO_NONE, MQHO_NONE, _
mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqExecute failure."
Exit Property
End If

' Count number of system bags are embedded in the response bag.
mqCountItems responseBag, MQHA_BAG_HANDLE, mvarQueueCount, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqCountItems failure."
Exit Property
End If

ReDim arQueue(mvarQueueCount)
ReDim arDepth(mvarQueueCount)
For i = 0 To mvarQueueCount - 1
' Get the system bag handle.
mqInquireBag responseBag, MQHA_BAG_HANDLE, i, systemBag, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqInquireBag failure."
Exit Property
End If

' Get the queue name from the system bag.
mqInquireString systemBag, MQCA_Q_NAME, 0, MQ_Q_NAME_LENGTH, strQName, _
intQNameLength, 0, mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqInquireString failure."
Exit Property
End If

' Get the queue depth from the system bag.
mqInquireInteger systemBag, MQIA_CURRENT_Q_DEPTH, MQIND_NONE, arDepth(i), _
mvarCompletionCode, mvarReasonCode
If mvarCompletionCode = MQCC_FAILED Then
mvarErrorMessage = "mqInquireInteger failure."
Exit Property
End If

arQueue(i) = Trim(strQName)
Next i

' Clean up
If adminBag > 0 Then _
mqDeleteBag adminBag, mvarCompletionCode, mvarReasonCode ' Delete the admin bag.
If systemBag > 0 Then _
mqDeleteBag systemBag, mvarCompletionCode, mvarReasonCode ' Delete the system bag.
If responseBag > 0 Then _
mqDeleteBag responseBag, mvarCompletionCode, mvarReasonCode ' Delete the response bag.
End Property
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportProblem Listing remote Queues
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.