Author |
Message
|
elledido |
Posted: Tue Feb 25, 2020 3:25 am Post subject: PCF agent returns error code 2100 |
|
|
Newbie
Joined: 25 Feb 2020 Posts: 5
|
Hello, I have a problem with PCF message agent while inquiring channel in order to obtain informations about hosts connected to a given queue manager. The code of PCFAgent is
Code: |
MQGetMessageOptions getMessageOptions = new MQGetMessageOptions();
getMessageOptions.options = MQC.MQGMO_BROWSE_NEXT + MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING;
messageAgent = new PCFMessageAgent(MQEnvironment.hostname, MQEnvironment.port, MQEnvironment.channel);
|
and code of options is
Code: |
inquireOptions = new PCFMessage(CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS);
inquireOptions.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, "*");
inquireOptions.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE, CMQC.MQOT_CURRENT_CHANNEL);
inquireOptions.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, new int[]{
CMQCFC.MQCACH_CHANNEL_NAME, CMQCFC.MQCACH_CONNECTION_NAME, CMQCFC.MQIACH_MSGS,
CMQCFC.MQCACH_LAST_MSG_DATE, CMQCFC.MQCACH_LAST_MSG_TIME, CMQCFC.MQIACH_CHANNEL_STATUS
});
responses = messageAgent.send(inquireOptions);
|
[/code]
Not always, but occasionally the application resturns an exception that says "Completion Code 2, Reason 2100" and my host (the one on which the application is running) leaves a pending connection on the server that is never closed until the MQManager is restarted.
I've read that this exception is due to a conflict in creating dynamic queues, but in my code I don't create any queue.
Someone could help me? Sorry, I've no previous experiences with queue managers.
Thank you |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Feb 25, 2020 5:32 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Please post here the actual and complete error message where you see the r/c 2100. _________________ 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 |
|
 |
elledido |
Posted: Tue Feb 25, 2020 5:40 am Post subject: |
|
|
Newbie
Joined: 25 Feb 2020 Posts: 5
|
I capture the exception and print the error message, that is
Code: |
2020-02-25 08:40:01,523 ERROR ITMICP55 - "server ip address" - Completion Code 2, Reason 2100
|
I have not a stack trace.
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 25, 2020 6:22 am Post subject: Re: PCF agent returns error code 2100 |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
elledido wrote: |
I've read that this exception is due to a conflict in creating dynamic queues, but in my code I don't create any queue. |
If you're not creating any queues, where does the response to the PCF inquiry get delivered? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
elledido |
Posted: Tue Feb 25, 2020 6:32 am Post subject: |
|
|
Newbie
Joined: 25 Feb 2020 Posts: 5
|
Quote: |
If you're not creating any queues, where does the response to the PCF inquiry get delivered?
|
I don't know exactly. I create a PCFMessage array like
Code: |
PCFMessage[] responses = responses = messageAgent.send(options);
|
to store the responses.
in the "options" there is no explicit reference to a dynamic queue. I have just a channel name, an ip address and a port.
Is it possible that PCFMessageAgent creates diamically an implicit queue?
Thanks |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Feb 25, 2020 6:32 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
elledido wrote: |
I capture the exception and print the error message, that is
Code: |
2020-02-25 08:40:01,523 ERROR ITMICP55 - "server ip address" - Completion Code 2, Reason 2100
|
I have not a stack trace.
Thanks |
Please post the COMPLETE error, including the name of the object that the r/c 2100 error refers to. _________________ 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 |
|
 |
gbaddeley |
Posted: Tue Feb 25, 2020 2:29 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
elledido wrote: |
Is it possible that PCFMessageAgent creates diamically an implicit queue?
Thanks |
Yes. I have used this class. It is designed to make running PCF commands as easy as possible. No need to specify any queue names. eg. Very simple example of running a MQSC command in Vb.Net :
Code: |
Dim MqQmgr As MQQueueManager = New MQQueueManager( MyQmgrName, MqProps ) ' MqProps is a hash table containing client channel name, host, port etc
Dim MqPcfAgent As PCFMessageAgent = New PCFMessageAgent( MqQMgr )
Dim MyPcfRequest As PCFMessage = New PCFMessage(CMQCFC.MQCMD_ESCAPE)
MyPcfRequest.AddParameter(CMQCFC.MQIACF_ESCAPE_TYPE, CMQCFC.MQET_MQSC)
MyPcfRequest.AddParameter(CMQCFC.MQCACF_ESCAPE_TEXT, "display qlocal('MY.QUEUE') all")
Dim MyPcfResponses() As PCFMessage = MyPcfAgent.Send(MyPcfRequest)
...then loop through the MyPcfResponses array |
_________________ Glenn |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Feb 25, 2020 2:54 pm Post subject: Re: PCF agent returns error code 2100 |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
elledido wrote: |
Code: |
MQGetMessageOptions getMessageOptions = new MQGetMessageOptions();
getMessageOptions.options = MQC.MQGMO_BROWSE_NEXT + MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING; |
|
Why are you using MQGMO class? Your code is not getting MQMessages.
elledido wrote: |
occasionally the application resturns an exception that says "Completion Code 2, Reason 2100" and my host (the one on which the application is running) leaves a pending connection on the server that is never closed until the MQManager is restarted. |
That would be bad coding. Programming 101:
- If you open it, then make sure you close it.
- If you connect to it, then make sure you disconnect from it.
Add a finally to your try/catch code and put your disconnect logic in it.
Code: |
try
{
}
catch
{
}
finally
{
if (messageAgent != null)
messageAgent.disconnect();
} |
elledido wrote: |
I've read that this exception is due to a conflict in creating dynamic queues, but in my code I don't create any queue. |
The send method of the PCFMessageAgent class handles the creation of the temporary dynamic queue. There could be a bug in the code.
What is the exact version (i.e. 9.0.0.4) of the MQ JAR files that you are using?
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
hughson |
Posted: Tue Feb 25, 2020 9:12 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
|
Back to top |
|
 |
elledido |
Posted: Wed Feb 26, 2020 3:00 am Post subject: |
|
|
Newbie
Joined: 25 Feb 2020 Posts: 5
|
Thanks a lot Morag! This is very useful. I've just another question, please. What is the difference between
Code: |
setReplyQueuePrefix(String prefixP) |
and
Code: |
setModelQueueName(String prefixP) |
Can I use the latter in order to create a unique dynamic queue?
I tried to follow you advice and I created an MD5 digest with a concatenation of some (hope unique) strings and I would to use this digest in order to make a unique dynamic queue. The code could be, for example
Code: |
PCFMessageAgent messageAgent = optMessageAgent.get();
String prefix = this.getMD5digest((this.getClass().getName() + "." + this.jobName +"." + new Timestamp(System.currentTimeMillis())));
LOGGER.debug("Prefix = " + prefix);
messageAgent.setReplyQueuePrefix(prefix);
logger.debug("PCFMessageAgent with dynamic queue " + messageAgent.getModelQueueName() + " created");
PCFMessage[] responses = this.inquireChannel(messageAgent);
|
what I get from the execution of my code is
Code: |
2020-02-26 11:48:15 DEBUG MQConnectionsMonitor:81 - Prefix = bd46b443d6e2723e9561e36d8b05d701
2020-02-26 11:48:15 DEBUG MQConnectionsMonitor:83 - PCFMessageAgent with dynamic queue SYSTEM.DEFAULT.MODEL.QUEUE created
|
I've some doubts about that "SYSTEM.DEFAULT.MODEL.QUEUE", I think there is something wrong.
Thanks |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 26, 2020 5:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
elledido wrote: |
Can I use the latter in order to create a unique dynamic queue?
I tried to follow you advice and I created an MD5 digest with a concatenation of some (hope unique) strings and I would to use this digest in order to make a unique dynamic queue. The code could be, for example
Code: |
PCFMessageAgent messageAgent = optMessageAgent.get();
String prefix = this.getMD5digest((this.getClass().getName() + "." + this.jobName +"." + new Timestamp(System.currentTimeMillis())));
LOGGER.debug("Prefix = " + prefix);
messageAgent.setReplyQueuePrefix(prefix);
logger.debug("PCFMessageAgent with dynamic queue " + messageAgent.getModelQueueName() + " created");
PCFMessage[] responses = this.inquireChannel(messageAgent);
|
what I get from the execution of my code is
Code: |
2020-02-26 11:48:15 DEBUG MQConnectionsMonitor:81 - Prefix = bd46b443d6e2723e9561e36d8b05d701
2020-02-26 11:48:15 DEBUG MQConnectionsMonitor:83 - PCFMessageAgent with dynamic queue SYSTEM.DEFAULT.MODEL.QUEUE created
|
I've some doubts about that "SYSTEM.DEFAULT.MODEL.QUEUE", I think there is something wrong.
Thanks |
No the response is correct. in the last part you did not ask for the name of the dynamic response queue, but you asked for the name of the model queue used to generate it, and that is the SYSTEM.DEFAULT.MODEL.QUEUE.
So nothing wrong there  _________________ MQ & Broker admin |
|
Back to top |
|
 |
elledido |
Posted: Wed Feb 26, 2020 5:47 am Post subject: |
|
|
Newbie
Joined: 25 Feb 2020 Posts: 5
|
fjb_saper wrote: |
No the response is correct. in the last part you did not ask for the name of the dynamic response queue, but you asked for the name of the model queue used to generate it, and that is the SYSTEM.DEFAULT.MODEL.QUEUE.
So nothing wrong there  |
Thanks a lot! Yes, I was pretty sure that it was simply a "model", but I had some doubts
So, do you think the MD5 digest on that string could be a good choice in order to avoid concurrency problems?
I have a fully qualified class name + a job name (unique name) + a timestamp.
I will try.
Thanks |
|
Back to top |
|
 |
hughson |
Posted: Wed Feb 26, 2020 2:19 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
elledido wrote: |
What is the difference between
Code: |
setReplyQueuePrefix(String prefixP) |
and
Code: |
setModelQueueName(String prefixP) |
Can I use the latter in order to create a unique dynamic queue?
|
setModelQueueName tells the queue manager which QMODEL object to use as the template.
setReplyQueuePrefix tells the queue manager a portion of the resultant created temporary queue name. If you end this prefix with an asterisk, then the queue manager will fill in the rest with a timestamp, so you only need to create the stem with something that will help with your concurrency.
Read more about this field in the underlying MQI here:
DynamicQName (MQCHAR48)
Cheers,
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Feb 26, 2020 2:34 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Code: |
String prefix = this.getMD5digest((this.getClass().getName() + "." + this.jobName +"." + new Timestamp(System.currentTimeMillis())));
LOGGER.debug("Prefix = " + prefix);
messageAgent.setReplyQueuePrefix(prefix); |
Best practice for dynamic queue name prefixes is to use a high level qualifier, optionally followed by your own random part. eg. "MYDYNQ.1e9a8fec12fad48e". MQ then appends a randomly generated suffix. The prefix should be fewer than 33 chars.
There is also a System.nanoTime() function that may return more precision than System.currentTimeMillis(). The process PID is probably more unique than the class name and job name. _________________ Glenn |
|
Back to top |
|
 |
|