No Receive after exception

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

No Receive after exception

andiL
When I try to receive the response message from a previus send command an exception is thrown.
--snippet ---
 CatchExceptionBuilder catchEx = catchException();
 catchEx.exception("org.springframework.web.client.HttpClientErrorException");
 catchEx.when(send, receive);
-- snippet ---
The send command throws HttpClientErrorException, which is catched.
But receive gets an ActionTimeoutException.
In integration tests there is a need to execute steps even if prevoius actions fail.
How can this goal be reached with citrus, especially for the send/receive case ?


Reply | Threaded
Open this post in threaded view
|

Re: No Receive after exception

Christoph Deppisch
Administrator
I do not understand what you mean by "receive the response message from a previus send". Could you please outline your test scenario in detail?

What I can say right now is that your "receive" action is never called, because the "send" is a blocking action. No further test action is executed until send has received its response. This is because Http is a synchronous protocol by nature.

So if you need to execute some other test actions in parallel to "send" you need to add a "fork"=true option to that send action in the first place.

This will fix your ActionTimeoutException issue.
Reply | Threaded
Open this post in threaded view
|

Re: No Receive after exception

andiL
In my example I call send and receive within "when", which are executed sequentially. The action names are just alias for the real send and receive actions from citrus. The endpoint is for both actions the same.