Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

WebClient fire & forget

$
0
0
Hi,

We currently use WebClient (.put/.post/.get etc) for sending messages synchronously from Rest service 1 to Rest service 2. We now have a requirement to send a message to Rest service 2 but not bother waiting until that service completes as it may take a long time i.e. a fire & forget scenario.

So assume I am using a "post" to send data to Rest service 2 it looks like I would use public <T> Future<T> post(javax.ws.rs.client.InvocationCallback<T> callback). But given I don't want / care about whether the call has been successful or not I presume I just declare a an javax.ws.rs.client.InvocationCallback which does nothing and I just ignore the Future?

Also, let's say that Rest service 2 can take up to 10 seconds to complete it's work, I don't want Rest service 1 to hang around waiting for the callback so would I just specify a short receive timeout in the WebClient configuration and let Rest Service 2 fail when it tries to send a response back?

Apologies if this is obvious, I just haven't used the async behaviour before.

Many thanks

Mandy

Viewing all articles
Browse latest Browse all 5648

Trending Articles