Hi…
Our source system which is connected to webMethods BrokerTransactionalClient, sends events which is stored in webMethods Broker queue.
Once all the documents are sent to the broker, a service is invoked which retreives the documents from the Broker queue, through the method Class : class BrokerTransactionalClient and method : getEvents
we use the following code to retreive the events from the Broker queue.
IDataCursor pipelineCursor = pipeline.getCursor();
try
{
BrokerTransactionalClient BTC = (BrokerTransactionalClient) IDataUtil.get(pipelineCursor,“clientConnection”);
int numEvents = BTC.getQueueLength();
String eventContent = new String[numEvents];
BrokerEvent event;
BrokerEvent events = BTC.getEvents(numEvents,-1);
for(int i = 0; i < numEvents; i++)
{
eventContent[i] = events[i].getStringField(“Content”);
BTC.acknowledge(events[i].getReceiptSequenceNumber());
}
IDataUtil.put(pipelineCursor, “eventContents”, eventContent);
IDataUtil.put(pipelineCursor, “numberOfEvents”, numEvents);
Log(“Retrieved " + numEvents + " from the Broker.”,“INFO”,“”);
}
catch(BrokerException E)
{
StackTraceElement stack = E.getStackTrace();
String errorStack = “”;
for(int i = 0; i < stack.length; i++)
{
errorStack = errorStack + stack[i].toString() + “\n”;
}
Log(“Error retreiving events!”, “ERROR”, errorStack);
throw new ServiceException(E);
}
pipelineCursor.destroy();
Now, the interesting part is that, the above code works fine if the document queue size is 15. If the queue size is more, then we get “java.lang.ArrayIndexOutOfBoundsException: 15” error.
Please suggest.
Thanks
Rocky