Broker Timeout Exception

Hi,
I am working in GE.
My team is building a new request reply integation in webMethods 6.x.
We are able to see the request and corresponding response in document tracker. But when we tried to access from application, we are getting timeout exception. But we are able to see the reply for the same request which is giving timeout exception in the document trracker.
Following is the test program i am using…

import com.gepower.geep.wm.ConnectionPooling.WMPublishRequestReply;
import com.gepower.geps.common.eai.data.QueryPartLifeReplyStorage;
import com.gepower.geps.common.eai.data.QueryPartLifeRequestStorage;
public class TestPartLife{
public static void main(String args[]){
// Set classpath=%classpath%;.;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\QueryPartLifeReplyStorage.jar;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\QueryPartLifeRequestStorage.jar;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\WMConnectionPooling.jar;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\client61.jar
// Set classpath=%classpath%;.;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\QueryPartLifeReplyStorage.jar;C:\QueryPartLifeRequestStorage.jar;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\WMConnectionPooling.jar;C:\Servers\apache-tomcat-5.5.20\Applications\SCMT_BR_4_0\SCMT_2.1T3\war\WEB-INF\lib\client61.jar
try{
System.out.println(“******1111”);
QueryPartLifeRequestStorage objlQphRequest = new QueryPartLifeRequestStorage();
QueryPartLifeReplyStorage objlQphReply = new QueryPartLifeReplyStorage();
QueryPartLifeReplyStorage objlQphReplyFinal = new QueryPartLifeReplyStorage();
WMPublishRequestReply objlClient = new WMPublishRequestReply();
String strStatus = null;
String slStatus = null;
String temp = null;
try {
strStatus = objlClient
.init( “3.209.5.12:6849”, “Broker #1”, null, “PLDB_EPDM_Service_Request_Client”,
null, null, null, “SCMT”,
1, 1, 1000000, 0.0);
System.out.println(“****strStatus ***” + strStatus );
System.out.println(“****objlClient " + objlClient );
objlQphRequest.PART_TYPE_ID = “GTTBRG001”;
objlQphRequest.PART_TYPE = “BUCKET STAGE 1”;
objlQphRequest.PART_SN = “C1SB083003”;
objlQphRequest.PART_DWG = “103E5592P001”;
System.out.println("
:111”);
slStatus = objlClient.requestReply(“wm::is::Canonical::QueryPartLife::QueryPartLifeRequestDoc”,
“wm::is::Canonical::QueryPartLife::QueryPartLifeReplyDoc”,
objlQphRequest, objlQphReply, 600000);
System.out.println(“****slStatus ***” + slStatus );
objlQphReplyFinal = (QueryPartLifeReplyStorage)objlQphReply;
temp = objlQphReplyFinal.ERROR_CODE;
System.out.println(“****Error code ***” + temp );
temp = objlQphReplyFinal.CURR_STATE;
System.out.println(“****Event ***” + temp );
} catch (Exception me) {
System.out.println(“exception occurred::” + me.toString());
}
}
catch(Exception e){
e.printStackTrace();
}
}
}

Really appreciate if somebody can help in resolving this issue.

Check the permissions to wm::is::Canonical::QueryPartLife::QueryPartLifeReplyDoc from the PLDB_EPDM_Service_Request_Client client group. My guess is that the client doesn’t have subscribe rights to that, which it must have to receive the event.

Hi Reamon,

Thanks for your quick comments. But we are able to see the reply in document tracker after i connect to the same clientgroup and do a request reply from their.

If you have a sample test code for a request reply integration, pls post to this thread for reference…

Thanks,
Babu

Hi, I tried with a different test program and saw the below error. I am not sure what exactly is the reason… any idea to fix this error.

Code:
import com.gepower.geps.common.eai.data.QueryPartLifeReplyStorage;
import com.gepower.geps.common.eai.data.QueryPartLifeRequestStorage;
import COM.activesw.API.client.BrokerClient;
import COM.activesw.API.client.BrokerConnectionDescriptor;
import COM.activesw.API.client.BrokerEvent;
import COM.activesw.API.client.*;
public class TestGenerator {
public static void main(String args[]){
try{
System.out.println(“******0000”);
QueryPartLifeRequestStorage objlQphRequest = new QueryPartLifeRequestStorage();
QueryPartLifeReplyStorage objlQphReply = new QueryPartLifeReplyStorage();
QueryPartLifeReplyStorage objlQphReplyFinal = null;
String strStatus = null;
String slStatus = null;
String temp = null;
BrokerClient client = new BrokerClient(“3.209.5.12:6849”,
“Broker #1”, null, “IntegrationServer”, “PLDB_EPDM_Service_Request_Client”,null );
BrokerEvent document = new BrokerEvent(client,“wm::is::Canonical::QueryPartLife::QueryPartLifeRequestDoc”);
objlQphRequest.PART_TYPE_ID = “GTTBRG001”;
objlQphRequest.PART_TYPE = “BUCKET STAGE 1”;
objlQphRequest.PART_SN = “C1SB083003”;
objlQphRequest.PART_DWG = “103E5592P001”;
document.fromObject(objlQphRequest);
System.out.println(“****b4 publish ***” );
System.out.println(“*after Setting ToObject” );
client.publish(document);
System.out.println(“*after publish 1” );
BrokerEvent replyEvent[] = client.publishRequestAndWait(document, 600000);
System.out.println(“after publish and wait”);
System.out.println(“****replyEvent[0] ***” + replyEvent[0].getBaseTypeName());
} catch (Exception me) {
me.printStackTrace();
}
}
}
------------------------------
Error:

 Bad State (200-1001): Cannot register callback for a tag before registering a ge
neral callback
        at COM.activesw.api.client.BrokerClient.registerCallbackForTagInternal(B
rokerClient.java:6328)
        at COM.activesw.api.client.BrokerClient.publishRequestAndWaitInternal(Br
okerClient.java:2722)
        at COM.activesw.api.client.BrokerClient.publishRequestAndWait(BrokerClie
nt.java:2635)

A general callback is a registered function that handles events that the client isn’t specifically waiting for (roughly). Before using request/reply, you must register a general callback. My guess on why you’re seeing this with the new test app is because the com.gepower.geep.wm.ConnectionPooling.WMPublishRequestReply has likely registered a general callback–and the second test program doesn’t appear to use that.

Double-check all your event names.

I assume WMPublishRequestReply.requestReply() has previously been debugged and isn’t a suspect in this issue.

Hi,

Can you provide an example code that have the callback registration…

Unfortunately, no. It’s been some time since I’ve done any Broker API coding. IIRC, the API docs have samples.

I fixed the issue with Call Back. the next error I am seeing is…

Timeout (112-1450): The request timed out.
at COM.activesw.API.client.BrokerClient.dispatchInternalBrokerClient.ja
va:6650)
at COM.activesw.API.client.BrokerClient.dispatchBrokerClient.java:6604)
at COM.activesw.API.client.BrokerClient.publishRequestAndWaitInternal(BrokerClient.java:2738)
at COM.activesw.API.client.BrokerClient.publishRequestAndWaitBrokerClie
nt.java:2635)

Can you provide any suggestions to fix this error. i tried couple of options. But the error still exists

Do this before the publish:

document.setTag(client.makeTag());

Chapter 6 of the Broker Client Java API Programmer’s Guide (for version 6.5) is a must read.

Hi,

I checked the code by setting tag before publish. Still getting the error. Following is the java code i am using to test.

Java Code:

import com.gepower.geps.common.eai.data.QueryPartLifeReplyStorage;
import com.gepower.geps.common.eai.data.QueryPartLifeRequestStorage;
import COM.activesw.API.client.BrokerClient;
import COM.activesw.API.client.BrokerConnectionDescriptor;
import COM.activesw.API.client.BrokerEvent;
import COM.activesw.API.client.*;
public class TestGenerator implements BrokerCallback {
public static void main(String args[]){
TestGenerator ttest = new TestGenerator();
ttest.test();
}
public void test()
{
try{
System.out.println(“******0000”);
QueryPartLifeRequestStorage objlQphRequest = new QueryPartLifeRequestStorage();
QueryPartLifeReplyStorage objlQphReply = new QueryPartLifeReplyStorage();
QueryPartLifeReplyStorage objlQphReplyFinal = null;
String strStatus = null;
String slStatus = null;
String temp = null;
BrokerClient client = new BrokerClient(“3.209.5.12:6849”,
“Broker #1”, null, “PLDB_EPDM_Service_Request_Client”, “SCMT”, null );
BrokerEvent document = new BrokerEvent(client,“wm::is::Canonical::QueryPartLife::QueryPartLifeRequestDoc”);
objlQphRequest.PART_TYPE_ID = “GTTBRG001”;
objlQphRequest.PART_TYPE = “BUCKET STAGE 1”;
objlQphRequest.PART_SN = “C1SB083003”;
objlQphRequest.PART_DWG = “103E5592P001”;
document.fromObject(objlQphRequest);
System.out.println(“****b4 publish ***” );
System.out.println(“*after Setting ToObject” );
client.publish(document);
System.out.println(“*after publish 1” );
boolean bCallBackflag = handleBrokerEvent(client, document, this);
client.registerCallback(this, null);
System.out.println(“bCallBackflag” + bCallBackflag);
document.setTag(client.makeTag());
BrokerEvent replyEvent[] = client.publishRequestAndWait(document, 600000);
System.out.println(“after publish and wait”);
System.out.println(“****replyEvent[0] ***” + replyEvent[0].getBaseTypeName());
} catch (Exception me) {
me.printStackTrace();
}
}
public boolean handleBrokerEvent(BrokerClient aEvent, BrokerEvent aBroker, Object aObject)
{
try {
return true;
} catch (Exception ex) {
System.out.println(“Exception message” + ex.toString());
return true;
}
}
}

Error:

Timeout (112-1450): The request timed out.
at COM.activesw.API.client.BrokerClient.dispatchInternal(BrokerClient.java:6650)
at COM.activesw.API.client.BrokerClient.dispatch(BrokerClient.java:6604)
at COM.activesw.API.client.BrokerClient.publishRequestAndWaitInternal(BrokerClient.java:2738)
at COM.activesw.API.client.BrokerClient.publishRequestAndWait(BrokerClient.java:2635)

Thanks,
Babu

Comment out the call to handleBrokerEvent.

In the handleBrokerEvent method, print a diagnostic message to show what event was received. The handleBrokerEvent method will be called automatically when anything other than the reply you’re expecting is delivered.

Add this into your code to double-check the permissions:

System.out.println("Can subscribe: " + client.canSubscribe(“wm::is::Canonical::QueryPartLife::QueryPartLifeReplyDoc”));

How is the response being generated?


Hi,

Still seeing the same issue even after commenting.
Latest Code:

import com.gepower.geps.common.eai.data.QueryPartLifeReplyStorage;
import com.gepower.geps.common.eai.data.QueryPartLifeRequestStorage;
import COM.activesw.API.client.BrokerClient;
import COM.activesw.API.client.BrokerConnectionDescriptor;
import COM.activesw.API.client.BrokerEvent;
import COM.activesw.API.client.*;
public class TestGen implements BrokerCallback {
public static void main(String args[]){
TestGen ttest = new TestGen();
ttest.test();
}
public void test()
{
try{
System.out.println(“******0000”);
QueryPartLifeRequestStorage objlQphRequest = new QueryPartLifeRequestStorage();
QueryPartLifeReplyStorage objlQphReply = new QueryPartLifeReplyStorage();
QueryPartLifeReplyStorage objlQphReplyFinal = null;
String strStatus = null;
String slStatus = null;
String temp = null;
BrokerClient client = new BrokerClient(“3.209.5.12:6849”,
“Broker #1”, null, “PLDB_EPDM_Service_Request_Client”, “SCMT”, null );
BrokerEvent document = new BrokerEvent(client,“wm::is::Canonical::QueryPartLife::QueryPartLifeRequestDoc”);
objlQphRequest.PART_TYPE_ID = “GTTBRG001”;
objlQphRequest.PART_TYPE = “BUCKET STAGE 1”;
objlQphRequest.PART_SN = “C1SB083003”;
objlQphRequest.PART_DWG = “103E5592P001”;
document.fromObject(objlQphRequest);
System.out.println(“Can subscribe: " + client.canSubscribe(“wm::is::Canonical::QueryPartLife::QueryPartLifeReplyDoc”));
System.out.println(”****b4 publish ***" );
// document.toObject(objlQphReply);
System.out.println(“*after Setting ToObject” );
document.setTag(client.makeTag());
client.registerCallback(this, null);
// boolean bCallBackflag = handleBrokerEvent(client, document, this);
// System.out.println(“bCallBackflag” + bCallBackflag);
// client.publish(document);
System.out.println(“*after publish 1” );
BrokerEvent replyEvent[] = client.publishRequestAndWait(document, 600000);
System.out.println(“after publish and wait”);
System.out.println("****replyEvent[0] **" + replyEvent[0].getBaseTypeName());
} catch (Exception me) {
me.printStackTrace();
}
}
public boolean handleBrokerEvent(BrokerClient aEvent, BrokerEvent aBroker, Object aObject)
{
try {
if (aBroker.isNullReply()) {
/
handle null reply /
System.out.println(“Null reply received”);
} else if (aBroker.isErrorReply()) {
/
handle error reply /
System.out.println(“Error reply received”);
} else {
/
process the event */
System.out.println(“Processing the event”);
}
return true;
} catch (Exception ex) {
System.out.println(“Exception message” + ex.toString());
return true;
}
}
}

Error:
******0000
Can subscribe: true
****b4 publish ***
*after Setting ToObject
*after publish 1
Timeout (112-1450): The request timed out.
at COM.activesw.API.client.BrokerClient.dispatchInternal(BrokerClient.java:6650)
at COM.activesw.API.client.BrokerClient.dispatch(BrokerClient.java:6604)
at COM.activesw.API.client.BrokerClient.publishRequestAndWaitInternal(Br
okerClient.java:2738)
at COM.activesw.API.client.BrokerClient.publishRequestAndWait(BrokerClient.java:2635)
at TestGen.test(TestGen.java:42)
at TestGen.main(TestGen.java:12)

My reply event is in the below format…

ERROR_CODE
ERROR_REASON


Line
Line [0]
parameter1
parameter2
Line[1]
parameter3
parameter4

Did you try the permissions call?

Hi Reamon,

I tried permission call also. It has the permissions.

The issue i am seeing is…
After I publish the request event, i am able to see the both request and reply in the document tracker under event log.

But API is not able to get the reply event that broker published though i am able to see the reply event.

Thanks,
Babu

Let me make sure I understand:

  1. You publish a request from your app.
  2. You see that request in Document Tracker.
  3. You see the response in Document Tracker
  4. You don’t see the response in your app.

Is that right? In that case, I know what the issue is. For a request/reply scenario, only the requestor should/will see the response. That is because it is delivered, not published. If you’re seeing the response in DocumentTracker that means it is being published, not delivered (that’s why I had asked how the response is being generated) and so your app will never see the response via the publisheRequestAndWait.

If I’ve misunderstood, let me know.

Hi,

Yes. Your understanding is correct. I am able to publish a request event, able to see both request and response events in document tracker but not able to to see the response in the application.

Can you tell me what is the change that i need to do in the above java program that i provided to see the results back…

Thanks,
Babu

The change to make if this is really a request/response is to have whatever is creating the response do a reply/deliver instead of a publish.

Doc Tracker is able to see the response event presumably because you created a subscription to that event type.

If that isn’t possible, then you have some choices to make:

  1. If the response MUST be correlated to the request, then you’ll need to store the request somewhere and subscribe to the response events that are published. Upon arrival, you’ll need to lookup the request using a data element that is in the response and then carry on with processing.

  2. If the response can be processed independently, just create a subscription (see the API docs) and process away.

I assume you understand the difference between publishing the response (which isn’t a really “response” in the request/response sense of the term–it’s just another event that someone published) and delivering the response.

Hi,

Thanks for your reply and your patience.

The integration that we are building is a pure request-reply integration.

In our case, request needs to be correlated to a response. We cannt process the response independently.

I checked with DeliverRequestAndWait method also. Still seeing the issue. Following is the java code:
import com.gepower.geps.common.eai.data.QueryPartLifeReplyStorage;
import com.gepower.geps.common.eai.data.QueryPartLifeRequestStorage;
import COM.activesw.API.client.BrokerClient;
import COM.activesw.API.client.BrokerConnectionDescriptor;
import COM.activesw.API.client.BrokerEvent;
import COM.activesw.API.client.*;
public class TestGen implements BrokerCallback {
public static void main(String args){
TestGen ttest = new TestGen();
ttest.test();
}
public void test()
{
try{
System.out.println(“******0000”);
QueryPartLifeRequestStorage objlQphRequest = new QueryPartLifeRequestStorage();
QueryPartLifeReplyStorage objlQphReply = new QueryPartLifeReplyStorage();
QueryPartLifeReplyStorage objlQphReplyFinal = null;
String strStatus = null;
String slStatus = null;
String temp = null;
BrokerClient client = new BrokerClient(“3.209.5.12:6849”,
“Broker #1”, null, “PLDB_EPDM_Service_Request_Client”, “SCMT”, null );
BrokerEvent document = new BrokerEvent(client,“wm::is::Canonical::QueryPartLife::QueryPartLifeRequestDoc”);
objlQphRequest.PART_TYPE_ID = “GTTBRG001”;
objlQphRequest.PART_TYPE = “BUCKET STAGE 1”;
objlQphRequest.PART_SN = “C1SB083003”;
objlQphRequest.PART_DWG = “103E5592P001”;
document.fromObject(objlQphRequest);
System.out.println(“Can subscribe: " + client.canSubscribe(“wm::is::Canonical::QueryPartLife::QueryPartLifeReplyDoc”));
System.out.println(”****b4 publish ***" );
// document.toObject(objlQphReply);
System.out.println(“*after Setting ToObject” );
document.setTag(client.makeTag());
client.registerCallback(this, null);
// boolean bCallBackflag = handleBrokerEvent(client, document, this);
// System.out.println(“bCallBackflag” + bCallBackflag);
// client.publish(document);
System.out.println("after publish 1" );
BrokerEvent replyEvent[] = client.deliverRequestAndWait(client.getClientId() ,document, 60000);
System.out.println(“after publish and wait”);
for( int i = 0; i < replyEvent.length; i++) {
if (replyEvent[i].isNullReply()) {
/
process null reply /
System.out.println(i + ": " + “Getting null reply”);
} else if (replyEvent[i].isErrorReply()) {
/
process error reply /
System.out.println(i + ": " + “Getting Error reply”);
} else {
/
process reply */
System.out.println(i + “: " + “processing replies”);
}
}
System.out.println(”****replyEvent[0] **" + replyEvent[0].getBaseTypeName());
} catch (Exception me) {
me.printStackTrace();
}
}
public boolean handleBrokerEvent(BrokerClient aEvent, BrokerEvent aBroker, Object aObject)
{
try {
if (aBroker.isNullReply()) {
/
handle null reply /
System.out.println(“Null reply received”);
} else if (aBroker.isErrorReply()) {
/
handle error reply /
System.out.println(“Error reply received”);
} else {
/
process the event */
System.out.println(“Processing the event”);
}
return true;
} catch (Exception ex) {
System.out.println(“Exception message” + ex.toString());
return true;
}
}
}

Output:
******0000
Can subscribe: true
****b4 publish ***
*after Setting ToObject
*after publish 1
Timeout (112-1450): The request timed out.
at COM.activesw.API.client.BrokerClient.dispatchInternal(BrokerClient.ja
va:6650)
at COM.activesw.API.client.BrokerClient.dispatch(BrokerClient.java:6604)
at COM.activesw.API.client.BrokerClient.publishRequestAndWaitInternal(Br
okerClient.java:2738)
at COM.activesw.API.client.BrokerClient.deliverRequestAndWait(BrokerClie
nt.java:2683)
at TestGen.test(TestGen.java:43)
at TestGen.main(TestGen.java:12)


I am seeing the same error which i saw with PublishRequestAndWait. In the error trace, I am seeing that evendeliverRequestAndWait is also calling the same method that PublishRequestAndWait called. The method that is called is “publishRequestAndWaitInternal”.

Really appreciate if you can change the code that i have provided in this comments if possible and provide which i can try…

Thanks,
Babu

The issue does not exist on the publisher side of the code–it’s on the responder. What is the code that is creating the response? Is it an IS FLOW service? Is it Java code? I think that’s where the answer now lies.