|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Config Manager proxy - |
« View previous topic :: View next topic » |
Author |
Message
|
raja_no_1 |
Posted: Thu Mar 19, 2009 5:35 am Post subject: Config Manager proxy - |
|
|
 Apprentice
Joined: 05 Sep 2005 Posts: 34
|
I am writing a tool for deploying bar files to the broker and using the CMP APIs to achieve this.
I am checking both the deployResult and the logEntry.isErrorMessage() to see if the deployment has failed. But some of the times the deployment does fail and but these 2 objects does not report an error.
Please can someone point out where I am going wrong?
----------------------part of the code --------------------
ExecutionGroupProxy e = broker.getExecutionGroupByName(egName);
LogProxy l = cmp.getLog();
boolean isError = false;
DeployResult deployResult = e.deploy(barFileName, true,60000);
completionCode = deployResult.getCompletionCode().toString();
isError=logDisplay(l);
if (completionCode.toString().equals("success")||!isError)
{
logger.info("## SUCCESS Deployed "+barFileName+ " to Execution Grp =>"+egName);
}
public static boolean logDisplay(LogProxy l) {
boolean isError= false;
try {
// commented for now.
//l.clear();
Enumeration e = l.elements();
while (e.hasMoreElements()) {
LogEntry thisEntry = (LogEntry) e.nextElement();
if (thisEntry.isErrorMessage())
{
logger.info("*** Event log = "+thisEntry.getDetail());
isError = true;
}
}
} catch (Exception ex) {
logger.info(ex);
}
return isError;
}
} |
|
Back to top |
|
 |
mqmatt |
Posted: Thu Mar 19, 2009 7:37 am Post subject: |
|
|
 Grand Master
Joined: 04 Aug 2004 Posts: 1213 Location: Hursley, UK
|
I wouldn't separately gain a handle to the LogProxy object in this case; potentially another application could come in after the deploy finishes, and you'll be reading messages from the wrong deployment.
Instead, read the deployment messages as returned to you inside the DeployResult object, something like:
Code: |
DeployResult dr = eg.deploy(...);
if (dr.getCompletionCode() != CompletionCodeType.success) {
Enumeration e = dr.getLogEntries(); // e is an enumeration of LogEntry messages from the CM pertaining to this deployment
Enumeration e2 = dr.getLogEntriesForBroker(eg.getParent()); // e2 is an enumeration of LogEntry messages from the broker pertaining to this deployment
}
|
HTH
-Matt |
|
Back to top |
|
 |
raja_no_1 |
Posted: Thu Mar 19, 2009 8:11 am Post subject: |
|
|
 Apprentice
Joined: 05 Sep 2005 Posts: 34
|
Thanks for your reply
---------
Enumeration e = deployResult.getLogEntries();
---------------------------------------------------
I tried doing this and this is the message I get
--------------------------------------------
Event log = BIP1520I: The Configuration Manager has initiated a deployment operation.
The Configuration Manager received a request to deploy configuration data and has consequently asked the following brokers to change their configuration: D8WMB03
The receipt of this message does not necessarily mean that deployment was successful; view the Event Log Editor in the Message Brokers Toolkit to check the outcome of the deployment. If you are deploying programmatically using the Config Manager Proxy, check the returned DeployResult object or LogProxy. There will be a separate set of log messages for each broker
---------------------
This is as good as checking the DeployResult which only reflect the state soon after executing this and doesnot change even if this was to be executed after a delay of 20 seconds..
DeployResult deployResult = e.deploy(barFileName, true,60000);
and this state can be initiated, pending, submitted etc
Since I am deploying stuff as part of automated script , everytime I get anything apart from return code "success" I dont want to stop the deployment.
I only want the program to stop if there was a failure.
The event log does suggest to check the LogProxy as well..
What would be the best way forward for this. Kindly help. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Mar 19, 2009 8:16 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Quote: |
A value of AttributeConstants.DEPLOYRESULT_WAIT_INDEFINITELY causes the method to wait until responses have been received from all brokers affected by the deploy. |
|
|
Back to top |
|
 |
mqmatt |
Posted: Thu Mar 19, 2009 8:38 am Post subject: |
|
|
 Grand Master
Joined: 04 Aug 2004 Posts: 1213 Location: Hursley, UK
|
You should use getCompletionCode() to tell you the final status of the deployment, not the presence of BIP1520.
If the returned completioncode == CompletionCodeType.success, then you know that the broker processed the deploy and is running with the newly deployed objects... even if you see the BIP1520 from the Config Manager.
When getLogEntries() returns BIP1520, it just means that the Config Manager sent this message out at some point during the deployment that you started.
It might be followed by messages from the broker which say that the deployment was successful (or failed). |
|
Back to top |
|
 |
raja_no_1 |
Posted: Fri Mar 20, 2009 5:08 am Post subject: |
|
|
 Apprentice
Joined: 05 Sep 2005 Posts: 34
|
Thanks again for your responses
I am using in my code
completionCode = deployResult.getCompletionCode().toString();
Which can return any of the following values e.g
initiated, pending, submitted , success, failure as said earlier.
However what does my progam do if I get the response as one of the 3 initiated, pending, submitted ?
Is there any more options other then the program attempting to redeploy?
MQMATT : My be if I get ur Sametime ID pn PM I could ping you and discuss as I am an IBMer |
|
Back to top |
|
 |
mqmatt |
Posted: Fri Mar 20, 2009 6:04 am Post subject: |
|
|
 Grand Master
Joined: 04 Aug 2004 Posts: 1213 Location: Hursley, UK
|
(As a matter of style, don't compare literal strings like "success", compare the supplied constant values such as CompletionCodeType.success instead. These are properly type-checked and guard against these constant strings changing in the future.)
You can only get a completion code of 'pending' if your application calls ConfigManagerProxy.beginUpdates() prior to the deployment, so that indicates a logic error in your application.
'Submitted' means that the CM didn't respond in time, and 'Initiated' means that the broker didn't respond in time.
You can guard against both of these by increasing the timeout value you supply on the deploy() call, but if you do get either of these returned, it indicates an error in your CM or broker (or at least, a slow performing or stopped component), and as such you should use your application to inform your administrator so they can start diagnosing the problem.
Cheers
-Matt |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|