Sending acknowledgement 200 http

Hey,

I got the follwoing issue:

I receive a http request from a java program, and i receive an xml.
Now i want to resend an acknowdlegement ‘200’ to the program, but before the flow which receives the request is finished…

How do we do this?

greetz,

Wout

Have you tried using with pub.flow:setResponse service.

HTH,

Wout

http 200 gets returned only when the process completes.
You might want to invoke a java service as the entry that will kick of the original flow with a Threaded invoke.
Like this

Service.doThreadInvoke( “namespace”, “servicename”, pipeline );

-Ravi

Or If you are positing to Tn Recieve… Make the Processing rule as Asynchronous

Wout,

Can you tell us why you want to ACK http 200 with out completing the process?Just wanted to know as a curiosity.

Regards,

The reason I want to do this is that I receive an XML over http and with this XML I do a some validations, i publish and wait a document and then i update a stored procedure.

But there is no reason why the sender of the XML has to wait untill I update the stored procedure. I want to send the acknowledgement, that I received the XML immediately so that the sending process can continue.

regards,

Wout

> But there is no reason why the sender of the XML has to wait untill
> I update the stored procedure. I want to send the acknowledgement,
> that I received the XML immediately so that the sending process can
> continue.

Hmm, you obviously know the situation on the ground better, but in most cases it is useful to insist that the HTTP submitting client parse the HTTP return status from the server, and if the status was anything other than an HTTP 200/OK, insist that it retry later on, or otherwise mark the delivery in error. This is about the only way plain HTTP can be made transactional - also, this is how the regular TN HTTP delivery agent works.

The doThreadedInvoke and the Async processing are good ideas. Back in an early version of TN (IS 4 or 3.6), I found Async processing was problematic - but it should be fixed by now.

So I used the Service.doThreadInvoke( “namespace”, “servicename”, pipeline )

It seems to work fine, but as I am not very familiar with threads,
i got the following question:

Are there performance issues to deal with?
Do I have to explicitly end the thread? How do I do this?

Kind regards,

Wout

No Implication.
The IS Controls the thread creation by “Server Thread Pool” Seting in resources.
When the Service Ends execution it is released back to the Pool.

-Ravi

See other posts here on WM Users about some exception handling approaches for services invoked on their own threads. What do you want to happen if an exception occurs on your process invoked on its own thread? Do you want to notify the user in any way?

Mark

Nope, the user is not notified directly, but a stored procedure is called to update a table. An error code is logged to notify if the action is performed correctly.

As time is an issue, we have chosen for the following solution:

In stead of starting a new thread, we publish a document locally; in this way the 200 ok is send and the flow that has to be executed is subscribed on this document.

The solution with the starting of a new thread, had some nasty side effects: When doin some load testing there were some threads that were never killed and at some points, new user sessions were opened and never closed…

kind regards,

Wout

Wout,

I’ve used the Service.doThreadedInvoke() approach extensively on projects with great results. If you implement exception handling correctly, you won’t have orphaned threads or extraneous sessions. If you just invoke a service on its own thread without handling exceptions or managing sessions, you will get exactly what you were seeing. That is an implementation issue, not an issue with the architecture of the Integration Server.

I’m glad you found a simple solution that would meet your requirements. Often, those are the very best kind.

Mark

(Message edited by mcarlson on May 09, 2004)

>> So I used the Service.doThreadInvoke( “namespace”, “servicename”, pipeline )
>> It seems to work fine

We are doing the exact same thing, but in the b2b 4.0.2 version. We are trying to asynchronously invoke a b2b service using the Service.doThreadInvoke.

When we invoke the java service(containing the Service.doThreadInvoke), from our web client, the pipeline that is passed from the Java Service to the b2b Service has the two string inputs passed to it, but a node input is somehow becoming null. This node should contain the XML document submitted from the web client using the text/xml content type. We installed SP3 on the server, but it still has not fixed the problem.
Any insights would be welcome.

Thanks,
Venkatesh