0 Replies Latest reply on Oct 1, 2014 1:15 PM by Mark Lybarger

    exception handling patterns

    Mark Lybarger Apprentice

      I'm looking for information on exception handling patterns specifically as it relates to switchyard services.

       

      Here's some pseudo code to show a sample application flow:

       

      Inbound JMS endpoint -> SomeCamelRoute ->

       

      @Service

      OrderFulfilmentService.fulfillOrder(OrderFulfillmentRequest ofr)

           @Service

           OrderProcessingService.processOrderSubmission(OrderSubmission os)

                @Named

                OrderDAO.locateOrder(Order o)  {

                     try {

                     } catch (NoResultsException e) {

                          throw new OrderServicingException(e);

                     }

                }         

       

      If the order can't be located, none of the processing can do anything about it.  The only thing I can think to do would be to throw it back to the queue for reprocessing and have it eventually end up on the DLQ.  I'm familiar with EE where years ago the bean would throw an EJBException and all processing would be rolled back, or the MDB would throw EJBException and the tx would rollback and the message would go back to the queue.

       

      I tried digging through the quickstarts and the FSW developer manual and came up a little short on information on exception handling for sy applications.

       

      I think I'm looking on insights as to whether my OrderServicingException should be checked or unchecked.  To roll back a transaction that might be in play, what should the application do?  If this were exposed via a soap service instead of jms, I'd expect a soap fault response; for jaxrs maybe an http 404 response code, etc. 

       

      thanks!