Action timeout while receiving message from channel

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

Action timeout while receiving message from channel

gituser25
Hi,
I am trying to configure citrus as HTTP server and followed the Java DSL implementation as mentioned in the following link
http://www.citrusframework.org/reference/html/#http-rest-server

I am getting the below exception when I hit this URL - http://localhost:8080/check/get?name=citrus.

com.consol.citrus.exceptions.ActionTimeoutException: Action timeout while receiving message from channel 'citrusHttpServer.inbound'

Can you please check and let me know if i am missing anything and help me to get this work? Thanks in advance

Here is my code:

<citrus-http:server id="citrusHttpServer"
                port="8080"
                auto-start="true"
                resource-base="src/test/resources"/>

        @Test
        @CitrusTest
        public void httpServerActionTest() {
     http().server("citrusHttpServer")
          .receive()
          .get("/check/get")
          .queryParam("name","citrus");


     
     http().server("citrusHttpServer")
          .send()
          .response(HttpStatus.OK);


     
    }
Reply | Threaded
Open this post in threaded view
|

Re: Action timeout while receiving message from channel

Christoph Deppisch
Administrator
Setup looks good to me. I wonder who is sending the request in your test setup though. Is it a manual GET request? I think the http server is waiting only 1000 ms for the incoming request before hitting the timeout. You should increase the timeout setting on the Citrus http-server component then.
Reply | Threaded
Open this post in threaded view
|

Re: Action timeout while receiving message from channel

gituser25
Hi Christoph,
Yeah its a manual request through browser. I believe i have tried increasing the timeout as well but still got the same error.

I have also tried sending the request through http-client with static response adapter (used the same example as that of sample proj), but i am ending up getting this message. Can you please help me to get both these use cases to work?

com.consol.citrus.exceptions.ValidationException: Validation failed: Unable to validate message payload - received message payload was empty, control message payload is not

  <citrus:global-variables>
        <citrus:variable name="todoId" value="test"/>
</citrus:global-variables>

   <citrus:static-response-adapter id="endpointAdapter">
    <citrus:payload>
        {
              "id": "${todoId}"
            }
    </citrus:payload>
 </citrus:static-response-adapter>
 


        http()
      .client(httpClient)
    .receive()
    .response(HttpStatus.OK)
    .payload("{\"id\":\"test\"}");

     http().server("dpHttpServer")
          .send()
          .response(HttpStatus.OK)
         .payload("{\"id\":\"test\"}");

Reply | Threaded
Open this post in threaded view
|

Re: Action timeout while receiving message from channel

Christoph Deppisch
Administrator
Your browser uses Http GET method by default and is not sending any request body. Your Citrus Http receive expects a body payload which is simply missing in your request. Please use proper Http POST request method and send the payload. The browser will not be the best client for this use case.