Announcement Announcement Module
Collapse
No announcement yet.
Spring batch reading from JMS , write to web service Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring batch reading from JMS , write to web service

    Hi ,
    I am pretty new to Spring batch and have a scenario that I wanted to run through you guys:
    [Read lines from a file -> validate each line -> push to jms - > ] ->[read object from jms -> publish to web service]

    the [] are to indicate steps. I wanted to know how does the JMS reader know that there are no further items to publish to the web service? I thought of adding some sort of end tag to identify that the end of line has been reached and there would be no more items to read for the JMS reader. But would like to know if there are any best practices around this.

    Apart from these, there is an initial step which validates the count of the items in file. Every file comes with a footer that contains the total number of records in the file. Only if the total number of records (Excluding the header and footer) match whats in the footer should the above mentioned steps take place of reading from the file.
    I also need to make sure that no duplicate calls happen to the web service. I know I have dumped a whole lot of requirements. Any directions as to components or documentation that I should look into would be very helpful.

    Regards,
    Anoop

  • #2
    To answer your questions:
    1. The JMSItemReader needs to return null in order for the step to complete so you'll have to wrap it in some way to identify per your business logic, when the input source has been exhausted.
    2. For the first step, take a look at the ValidatingItemProcessor for validation.

    Comment


    • #3
      Thank you, Michael for the pointers. I have used the the same apis you mentioned. Now I am running into another problem.
      I partitioned my data coming from the JMS queue so that it could be processed locally in a multi threaded way. However what I find is that though multiple partiioned steps are created and logged under the step_execution table, only one of the steps seem to be getting all the work. All the other steps arent processing anything at all. I am using Hornetq as my JMS broker. I am not sure its a server side config or something I need to do to the client JMSTemplate. I even tried setting it as protoype in the bean definition. I am also using a Connection Pool for the jms connection to the HornetQ. Appreciate any help you can provide.

      Thanks,
      Anoop

      Comment


      • #4
        Can you post the configuration you're using?

        Comment

        Working...
        X