Hi

See the options about using a timeout value to not wait for a long time
https://camel.apache.org/manual/consumertemplate.html#_receive_modes



On Thu, Mar 2, 2023 at 8:04 AM Penagos Jaime <
jaime.pena...@ub.uni-muenchen.de> wrote:

> Hello everyone,
>
> I am working right now with some REST Routes in Camel, and one of those
> routes is supposed to read a file on a specific folder and return the
> result. The name of the file is given on the URI (i.e. GET /file/{name}).
> It seems to work fine, although when I send the same request to that route,
> it won't return anything and just keeps waiting for response.
>
> Internally the route looks something like this:
>
>
> rest("/")
>      .get("/file/{name}").to("direct:getContent");
>
> from("direct:getContent")
>     .tracing()
>     .process(getContentProcessor)
>     .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
>     .transform(body());
>
>
>
> and within the processor I use a ConsumerTemplate to load the file:
>
> ...
>
> ConsumerTemplate myConsumer =
> exchange.getContext().createConsumerTemplate();
> String fileResult = (String) myConsumer.receiveBody(
>           "file:data?fileName=" + myFileToCheck + "&noop=true",
> String.class
>      );
>
> ...
>
> I *suppose* that when the consumer calls the endpoint, it gets the same id
> and Camel won't continue? What could be the issue here? I double checked
> (and also used the noop parameter to be certain the file stays in the same
> folder)
>
> Thanks for your advice,
>
> Best regards,
> Jaime Penagos
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to