Question

I am trying to fetch some information/data from (IBM) Websphere MQ using C#.
I did manage to get a message, but i can't figure out how to get details about the queue (e.g. are there any items, how many items are contained, etc).
Not Sure if it matter, but i use MQ 6.1 - the online API for c# provided by IBM is quite empty.

Any suggestions welcome.

Was it helpful?

Solution

The information you want is available as queue object properties. Some properties are settable, all are gettable. The app needs to have inquire and/or set rights on the queue in order for these to work.

The link you provided in the comment to Stephen's response is to a different section of the WMQ .Net manual. I suspect you are viewing it with curl or otherwise have script disabled or else you would have easily found the section I linked to above in the navigation panel. Any page loaded in a suitable browser will reload itself inside the navigation frame and display a table of contents on the left. The table of contents will be positioned on the page opened. The section you referenced was to compiling the .Net app but there is a complete API reference elsewhere.

I would recommend viewing the Infocenter in a Javascript-enabled browser with cookies, or else installing the local version of the Infocenter as an Eclipse workbench. The local version has the ability to pull down updates when the online manuals are updated. In either case, a navigation panel is provided which includes the complete set of WMQ manuals and is searchable across all of them, by individual book or by section within a book.

The landing page for WMQ documentation is here. This page contains links to the online Infocenters for v6 and v7, the downloadable Infocenters for v6 & v7 and the PDF versions of the older documentation.

EDIT - The drill-down path to definitions of the constants

  • From the MQC page readers are directed to the Application Programming Reference manual rather than directly to the MQC docs. However, the page displayed does not represent the whole APRM content! Click the plus sign in the navigation frame to open the TOC for the book.
  • The page Constants has no content other than to direct the reader to the Constants manual. Unfortunately, it's not linked but the manual is listed in the navigation frame simply as "Constants". Click the plus sign to expand the TOC.
  • This level contains the major sections of the book, one of which is the detail of all the constants under the heading of "Constants". Clicking that link opens an index page with all of the constants listed and links to a dedicated page for each.

OTHER TIPS

In the past I have used XMS: The IBM Message Service Client for .NET. The current version can be found at: IBM Message Service Client. You can also find a quick tutorial at C# Corner

In general you want to follow the pattern:

MQCONN 
MQOPEN the queue
loop
  MQGET from the queue
  Process the message
end loop

Make sure you specify MQGMO_WAIT on the MQGET call. You don't want to just poll the queue.

I'll try to find some source code when I get to the office.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top