Announcement Announcement Module
No announcement yet.
Event Processing scenario Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Event Processing scenario

    I have simple event processing scenario

    Read event from DB -> Send JMS message form event -> update event table based on JMS send exit code.

    Now I'm thinking how can I do it woth spring batch.

    Should I use one db reader and CompositeItemWriter having jmswriter and dbwriter

    Is it good idea to achieve thi or there is better way ?

    Additional question:

    How can I check jmswriter exit code within dbwriter from my scenario ?



  • #2
    That one is tricky because you want to make sure that the flag in the event table matches what happend in the course of the transaction. This is something that is independent of Spring batch, actually.

    The best way to deal with this is to always assume that everything is well and react to transaction failure accordingly. Taking Spring batch away, you would read the event, send a message, update the event table with a SUCCESS, commit the transaction. If something goes wrong, catch the exception that led to the rollback, update the status in the event table with an error in a REQUIRES_NEW transaction

    Back in Spring batch now, you would read the event from the database, process it if it needs to be and send the msg + update the table in a composite writer. In case of an error, you would make sure to configure it in such a way that it does not fail the job and add a listener to update the status with the error code you want.