Author |
Message
|
mqtablet |
Posted: Thu Oct 15, 2009 10:34 am Post subject: How to get the sender channel properties in c#? |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Hi All,
I'm a novice in coding C# with webSphere MQ.
I'm currently stuck in a situation where, I want to get the sender channel properties to a string variable. I'm not sure how to achieve this. Request your help on the same.
In Detail -
I have two string variables - strXMITQname and strChannelName;
I've defined a MQQueue object sxmitq;
sxmitq = queueManager.accessqueue(strXMITQname, MQC.MQOO_INQUIRE);
strChannelName = sxmitq.TriggerData (Trigger Data contains the name of the channel to be triggered)
now, I want to use that channel name, create a new channel object and want to inquire the Connection Name property of the channel.
How do I do this? Please help.
regards, |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 15, 2009 11:27 am Post subject: Re: How to get the sender channel properties in c#? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqtablet wrote: |
How do I do this? |
As a novice, why do you want to do this? There's no good reason for an application to be enquiring on these details, and even less for it to then create a new channel object.
Unless you're trying to write some kind of administrative application, which is a very hard wheel to re-invent. If you're the administrator for your site, look into some of the other solutions for creating channels. If you're not, speak to your admin before going forward and see what he says about this. The phrases "What the??" and "No way!!" may be included in their answer..... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqtablet |
Posted: Thu Oct 15, 2009 11:42 am Post subject: |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Hi Vitor,
Thanks for your response. Let me explain in detail what I'm doing here.
In our dev environment, we have two queue managers. A and B.
There is a remote queue on queue manager A, which is pointing to a local queue on queue manager B. The transmission queue on A is A.TQ
My MQ Administrator has given me the Ctrl and Ctrlx permissions on the sender channel A.B in A queue manager. (in other words, I have the permission to start the channel. Please correct me if I'm wrong).
If we put a message to the remote queue on A, the message moves ahead to the transmission queue (A.TQ) where channel triggering is enabled (using SYSTEM.CHANNEL.INITQ). Here the trigdata property of the xmitq contains the sender channel name.
The sender channel name in turn contains the status (whether it is running, stopped, inactive and host name. ) I want to record this channel state and the host name to a log file at my end, using my application.
I am not creating any type of channel on the queue manager A. The channel is already setup by the Admin team. I just want to inquire the properties of it. I'm able to inquire the properties of Queues, but I'm not sure how to use the MQ C# api to get the channel status and conname property of the channel.
Thanks, |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 15, 2009 11:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqtablet wrote: |
If we put a message to the remote queue on A, the message moves ahead to the transmission queue (A.TQ) where channel triggering is enabled (using SYSTEM.CHANNEL.INITQ). Here the trigdata property of the xmitq contains the sender channel name. |
Yes, that's true.
mqtablet wrote: |
The sender channel name in turn contains the status (whether it is running, stopped, inactive and host name. ) I want to record this channel state and the host name to a log file at my end, using my application. |
Why? What possible value does this information have to your application? Why did your admin give you this authority on a triggered channel which doesn't require intervention to start?
mqtablet wrote: |
I'm able to inquire the properties of Queues, but I'm not sure how to use the MQ C# api to get the channel status and conname property of the channel. |
Again I ask why you want or need this information on a channel. It's highly unlikely you need to enquire against the queue, unless you're making the classic mistake of trying to obtain queue depth so your application knows how many messages to read off......  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 15, 2009 11:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You can but you need to write your inquiries in pcf format and send them to the command processor.
Read the pcf manual (programmable command format) . Have a look at support pack MS0B (I know it's java but c# is not that far appart then right?)
The main question however is: Why would you as application be concerned with the innards of MQ workings. This is typically the job of MQ Monitoring and operations.
Have fun  _________________ MQ & Broker admin
Last edited by fjb_saper on Thu Oct 15, 2009 11:50 am; edited 1 time in total |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Oct 15, 2009 11:49 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
I want to record this channel state and the host name to a log file at my end, using my application. |
For what purpose? What will this information tell you? what will you do with information?
EDIT: If you are trying to write a monitoring tool, you will need to extract channel state information pretty much continuously (like once per second, or 60 times per second).
Why? Because RUNNING state only means that the channel is currently transmitting a message OR the MCA believes that it can transmit a message when a message next arrives in the xmit queue. In the latter case, when the MCA next tries to transmit a message (perhaps 1 microsecond from the last time it successfully sent a message) it might discover that the channel has failed.
So, again, what is the underlying purpose of your application? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
mqtablet |
Posted: Thu Oct 15, 2009 12:39 pm Post subject: |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Thanks again to you all.
In our company, the MQ team dedicated for development purposes works during US working time. We have two teams, one in India and one in US. During India working hours, we dont have any MQ admin person to take care of MQ issues, (usual one what I've faced is the channel going to retrying state because of sequence issues). In case we need support, we have to send and email in India morning time and wait till the India evening time (US morning) to get our issues resolved. A whole day is wasted for this. Hence the MQ team has given us permissions to start and stop the sender channel, reset it as and when necessary.
To administer MQ, we use MQ explorer and we can reset the channels there. However, loading of MQ explorer takes a long time (approximately 20~25 mins) to show the queues. Hence we want to inquire the status of the channel, if it is running, fine no problem. If it is retrying, we want to reset it , also check the remote host.
Thanks,  |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 15, 2009 12:49 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqtablet wrote: |
To administer MQ, we use MQ explorer and we can reset the channels there. However, loading of MQ explorer takes a long time (approximately 20~25 mins) to show the queues. |
Seriously?
Fixing that will be far, far faster and easier than writing another application. If starting explorer takes me 20-25 seconds I wonder why my machine is running slow.....
mqtablet wrote: |
Hence we want to inquire the status of the channel, if it is running, fine no problem. If it is retrying, we want to reset it , also check the remote host. |
If that's all you need to do, there are other, easier options. You could probably get by with runmqsc without difficulty.
But work out what's wrong with Explorer. That's not right. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Oct 15, 2009 12:51 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Channel sequence numbers are used to ensure that mq has successfully sent messages (not lost them).
Resetting the channel sequence numbers is something that should rarely/never need to be done. It is usually the result of someone at the other channel end deleting and recreating the channel with the same name.
I'd spend some time trying to figure out why the sequence numbers are out of sync. (Smack the sysadmin at the other end.)
What version of mq at both ends? What maintenance levels? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
mqtablet |
Posted: Thu Oct 15, 2009 12:58 pm Post subject: |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
My mistake about MQ explorer - I'm rephrasing the sentence.
MQ Explorer opens quickly, but it takes a long time to display the MQ objects of the requested queue manager. If I press the refresh button, again it takes a long time.
Source MQ Details
MQ v6.0 Server on MQ server(Fix Pack 6.0.2.4)
Windows 2003 Server Enterprise
Client version on Application Server : 6.0.2.5
Destination MQ Details
MQ v6.0 Server on MQ server (Fix Pack 6.0.2.7)
Windows 2003 Server Enterprise
Client version - 6.0.2.7
Please let me know if you need any more information.
Thanks in advance. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 15, 2009 1:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqtablet wrote: |
it takes a long time to display the MQ objects of the requested queue manager. If I press the refresh button, again it takes a long time.  |
I repeat - fix it. It shouldn't take that long.
I also echo the comments of my associate; you shouldn't need to be resetting channel sequence numbers that often, even in development. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqtablet |
Posted: Thu Oct 15, 2009 1:05 pm Post subject: |
|
|
Acolyte
Joined: 09 Jun 2009 Posts: 71
|
Thank you all for your time and responses.
I'll check it out why its taking so long for MQ explorer to refresh.
Update you with the results.
let me have some sleep now. Its already 2:30AM in India.
Bye. Have a nice day. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Oct 15, 2009 1:17 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
Its already 2:30AM in India. |
What kind of sysadmin goes home as early as 2:30am in India??! Doesn't this show a lack of dedication?  _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 16, 2009 10:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If he has performance problems with MQExplorer I would suggest using support pack MO71. You can limit the content you request to specific channels etc..., due to the vagaries of communications it may still take a long time but should be significantly under 20 mins...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|