Thanks, Yeah I'm reading Camel in action, Camel cookbook and EIP.  I'm
looking into request-reply and in particular what happens if the server
making the reply encounters an unexpected exception.

I think I'm not quite getting how to do inOut well from both sides and
handle the errors.  I cant find that much documentation / examples about in
out (a few pages in book, camel website pag).  For example, 
http://camel.apache.org/request-reply.html has a bit about request reply but
all the rules are just sending a message out from what I see.

For example this more real world problem:

   queue where data comes in -> process it -> request external server to
save data -> external server saves data ->  external server replies with a
receipt number -> server handles receipt number

So there's 2 applications, I would guess one with a route like:

  from(data)
       .process(data_process)
       .inOut(external_server)
       .to(reciept_queue)

and the other server with a route like:

 from(save_requests)
      .process(process_to_save)
      .bean(save_data_and_set_in_message_to_receipt)

I've written that and it seems to work fine, however,  if process_to_save
throws an error then the app making the request gets no reply / indication
of error and eventually just times out.

I though if the camel channel poking the process doesn't handle the
expression, it gives it up the the caller, and that flows back to the
ultimate caller. But that seems to be cut off at the inOut, i.e. its not
sending a reply back saying fail.

So I understand now that maybe some more exception handling should be
happening on the server saving the data, so I can add an exceptionHander:

 from(save_requests)
      .onException(Exception.class).transform(constant("failed reciept").?
      .process(process_to_save)
      .bean(save_data_and_set_in_message_to_receipt)

but I cant seem to find a way of returning the message back on the exchange
/ seemingly redirect it to a dead letter type queue.

It seems possible that I could reference back to the server, however, with
say netty I cant see a way of getting the consumer and producer for the same
endpoint.

I have the feeling I'm being an idiot here in some way...  Struggling to
find documentation / examples on this sort of things that arn't a handful of
lines long / incomplete.

Anyways I'm plugging away at it still, any help would be most appreciated. 
I've been trying to do this within one camel context which I believe should
still work (the 2 routes in my original post) but I may just write a couple
of applications like the real world problem I just described.

Thanks,
Jon



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-handling-tp5754013p5754155.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to