How can i query the expiredpending transactions

Hi,
i am using the remote invoke using the pub.remote.gd services.

Now lets say i excced the timeout/ttl then i get the transaction expired or pending. how can i get the docuement based on these transaction status and can roll back or resubmit the transaction? Is it possible to query the all transactions and get their status? any service for that available?

Thanks,
AS

We do this thru an sql call:
this will check for failed

SELECT *
FROM BizDoc OUTTER INNER JOIN
DeliveryJob ON OUTTER.DocID = DeliveryJob.DocID
WHERE ((DeliveryJob.JobStatus = ‘FAILED’) AND
((DeliveryJob.TimeCreated > ‘08/07/2002’) and (DeliveryJob.TimeCreated < ‘08/09/2002’)))

change dates as needed

then check your rowcount - loop over results
and run
wm.tn.task:restartTask linking docid to taskid to reststart the failed tasks

for pending - run

SELECT *
FROM deliveryjob
WHERE (jobStatus = ‘PENDING’

I haven’t figured out how to resend pendings.

Not sure what delivery method you are using, but you could always put in a flow try/catch around the delivery. If it fails, even after the first try, you could use the wm.tn.doc.changeStatus in the catch, to change the User Status to something unique (could be determined by how your delivering the document - https = HTTPS FAILURE, smtp = SMTP FAILURE, or depending on your registered delivery jobs). You could then query against that status in one table and get the docid’s for those failures, and then use wm.tn:reroute with the docID to re-deliver the documents. I believe then that this query wouldn’t matter if the job status was in a pending state or in a failed state in the delivery job table. I would also double check the documentation of the reroute serive. Hope this helps, or at least spawns other ideas.

-Ben

AS - you can use pub.remote.gd:retrieve to retrieve a failed GD transaction based on the tid. pub.remote.gd:getStatus will tell you if the transaction is PENDING, DONE, or FAILED. You’ll need the tid for this call as well. I’m not aware of anyway to query the GD job manager by status. So it will up to your service to track the tid of any failed transactions.

The other comments above only apply if you are using Trading Networks as your delivery engine.

Hope this helps.

Oh, yeah. You can load and search through the txin.log and txout.log files programmatically to get the tid for any failed transaction.

Hi,

Ya, i had to write the Java Service to get the list of tid and their status to submit them again…

its not the 100% efficient but i have to polish it up to make better…

but here is the code…

mike, is your query thing works fine? it never worked for me… as i wont even able to see in the table the info about the tids. i m really curious about it… i guess i am doing something wrong…


// get IDataCursor to manipulate pipeline

IDataHashCursor idhc = pipeline.getHashCursor();

idhc.first(“input”) ;
IData input = (IData)idhc.getValue();
Values result = null ;
TContext tc = null;

  //---Initialization---------------------------------------------------- 
  //   Initialize TContext and establish connection attributes 
  try { 

int i = 0 , j = 0 ;
String arrTid, arrStatus ;
arrTid = new String[50] ;
arrStatus = new String[50] ;

tc = new TContext();
String hostname = ServerAPI.getServerName() ;
String port = “” + ServerAPI.getCurrentPort() ;
tc.connect(hostname + “:” + port, “Administrator”, “manage”);

Enumeration enum = tc.getTxIds() ;
while (enum.hasMoreElements() )
{
arrTid[i] = (String)enum.nextElement() ;
arrStatus[j] = (String)tc.getTxStatus(arrTid[i]) ;
//System.out.println( “” + tc.getTxStatusVal(arrTid[i]) + “<\n” ) ;

//if ( (String)tc.getTxStatus(arrTid&#91;i]) == "FAILED" &#124;&#124; (String)tc.getTxStatus(arrTid&#91;i]) == "ERROR" ) 
// { //tc.restartTx(arrTid&#91;i]) ; 
//  result = tc.invokeTx(arrTid&#91;i], "EGMSagePP.Inbound", "retrievePOFromHub", (Values)input) ;  
// }      
i&#43;&#43; ; j&#43;&#43; ;  

}
idhc.insertAfter(“result”, result) ;
idhc.insertAfter(“tidList”, arrTid) ;
idhc.insertAfter(“statusList”, arrStatus) ;
idhc.destroy();

} catch (Exception e) {
// System.err.println("Error: "+e.getMessage());
// System.exit(-1);
throw new ServiceException(e.toString() ) ;
}

      tc.disconnect(); 

// TContext.shutdown();


i guess still have to add the checks and retry using the
isExceededRetries() and isHeuristicFailure() and all those sort of things to restart the and execute the service…

Does anyone has idea how can i add timer to this code?

Thanks,
AS

AS,
my sql query works great. We use queries all the time against the TN databases. The only time we have an issue is when we have to reference particular doc types because they have unique ids on both devl and production, so we always put a getHostid/branch on our services. We use queries to check for duplicate docs, etc.

Mike

Mike,
So is that means u are doing the Reliable Delivery not the Remote Invoke? so that way TN has the log of the transaction?

AS

We are doing deliveries - invokes (http) from Trading Networks. If the server we are posting to is down, the deliveries (posts) FAIL. I then run my sql service listed prior which will get the doc ids of the failed docs, and then I loop over the doc ids, use them as a key into the wm.tn.task:restartTask service, which trys to do the post again out of TN. It does not create new docs in TN - it restarts the delivery of the existing ones.
This way don’t have to go and manually resend a lot of docs from TN.

Hope that helps.

Mike