Announcement Announcement Module
No announcement yet.
Direct channels loose remaining messages if ones handling throws exception? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Direct channels loose remaining messages if ones handling throws exception?

    I have a "pipe" like this

    inbound adapter -> direct channel -> splitter -> direct channel -> chain (header enricher - service activator)
    The inbound adapter loads (via poller) 0-n objects from a database, and returns them as a list, the basic splitter splits the collection into single items which get added a error channel header, and based on the data, the service activator calls a remote service.

    Just like in the Error handling example, my service activator throws an exception if something goes wrong I can't deal with, based on the header data the message ends up in the proper channel and I get notified via email.

    The problem here is, if the channel before the service activator contains lets say 100 messages, and the first message throws an error, the 99 that are left are "silently" discarded.

    I can make it work properly but making the channel before the service activator chain a queue or a publish subscribe channel, but I still find the "default" behaviour quite counter intuitive. I guess i see some sense in the way its handled since its one thread doing the work, but its still kinda weird :P

    This is with SI 1.0.3, has this or will this be changed? Or should I just use publish-subscribe or queue channels and task executors?

  • #2
    I have a problem that's sorta similar to yours

    I ended up solving it by using a rendezvous queue channel before my main handler chain.

    One would think that if an exception occurs during message handling it would simply forward it to the errorChannel and then continue on with the other messages but this is not the case looking at the code.