Announcement Announcement Module
No announcement yet.
Spring Batch ItemReader - read data from Socket Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch ItemReader - read data from Socket

    I have a requirement for configuring a batch Job which will read data from the socket and write to a Database.
    I'm trying to figure out if there is a way to configure the ItemReader to listen to a socket. Can somebody in this forum help me with this?


  • #2

    it looks like some message driven processing. It's not so easy with spring batch. There was a thread on this forum about this type of processing (source has no matter in this case but behavour is the same).

    It is possible to prepare ItemReader to be a socket listener but the major problem here will be transaction timeout and long running job may cause the issues as well.

    What can I recommand is to prepare listener and store data in some file/db. Then process them periodicaly by spring batch job.



    • #3
      Hi Jul
      Thanks for your reply, Currently I've a separate process to read the data from socket and write to the file system as xmls and then Spring Batch process the xmls and store them in the DB. Everything works fine but just wanted to check if I can integrate the socket data reading in to the ItemReader. If it has issues I would better leave it in the existing way.



      • #4
        I have similar type of Job, I have tasklet job coded to read from Socket and write to file.
        My job runs continuously for 5 days, will that be considered long running job? Would spring batch have any issues if it runs continuously for 5 days?

        In another scenario where we have some formatting to be done before writing to file, I am planning to code reader to read from socket and then continue performing rest of the operations. Is this approach suggestable?