Announcement Announcement Module
No announcement yet.
Throwing Exception through payload-type-router Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Throwing Exception through payload-type-router

    I have a <gateway> custom channel that is picking up events and is passing them down a channel to a <chain>, when an exception is thrown somewhere in the <chain> it is correctly being passed back to the <gateway error-channel="..." > and that all works fine.

    So far so good ...

    However when I put a <payload-type-router > in-between the <gateway .. > and the <chain ... > to route the messages from the <gateway ... > to more than one <chain ... > THEN when I throw the same exception from the chain the exception dissappears !!

    So the question is what config am I supposed to use to ensure that an exception is correctly handled when passing from a <payload-type-router > to a <chain>?

  • #2

    I take that back it seems to have worked .. not sure what I did ...

    It would nice to have confirmation that exceptions are thrown back through routers?


    • #3

      Its more then that. Exceptions are always thrown back to the entry point of the flow *unless* they are somehow intercepted.
      The typical entry points are:
      1. Inbound Gateway (e.g., proxy, http, jms etc.)
      2. Pollers

      In the case of the gateway such as <int:gateway> where you simply invoke a method the downstream exception is thrown back at the caller *unless* you define an error-channel which give you the capability to intercept an exception and deal with it (sort of 'catch' block). And of HTTP (as an example) it will result to some 500 error *unless* it was intercepted via the error-channel and dealt with.
      Pollers are similar

      EventBasedConsumers do not have capability to trap and swallow the exception. That would be a serious bug on our end. So PayloadTypeRouter is not swallowing any exception. What i was going to suggest is that may be it didn't really route anywhere because of the wrong payload, but it seem like you got it figured out.


      • #4
        Thanks, it is all working for me.