1 Reply Latest reply on Sep 17, 2013 9:53 AM by tcunning

    Custom file read/write process in ESB

    mirko.richter

      Hi,

       

      Note: I'm using Fuse ESB 7.1 but i believe the problem described below can be solved very similar in JBOSS ESB too, so i also ask for a solution in this forum (duplicated here).

       

      i need to implement a custom file-based lock mechanism where i'm not sure if it is already supported by the file2 EIP Component. It presumes that for each file the existence of one process that reads from the file and one process that writes to the file. The following examples shortly explain the desired behaviour of the Reader- and the Writer-Process (access to file "CAMLAB.XML"):

       

      Writer-process:

       

      • Writer process wants a lock on the file ‘CAMLAB.XML’.
      • Writer process verifies that file ‘CAMLAB.XMR’ does not exist.
      • Writer process creates handshake file ‘CAMLAB.XMW’ to signal reader.
      • Writer process verifies again that file ‘CAMLAB.XMR’ does not exist.
      • Writer process writes data to ‘CAMLAB.XML’.
      • Writer process removes handshake file ‘CAMLAB.XMW’.

       

      Reader-process:

       

      • Reader process checks for presence of XML file ‘CAMLAB.XML’.
      • Reader process finishes when the XML file was not found.
      • Reader process verifies that ‘CAMLAB.XMW’ does not exist.
      • Reader process creates handshake file ‘CAMLAB.XMR’ to signal writer.
      • Reader process verifies again that file ‘CAMLAB.XMW’ does not exist.
      • Reader process reads data from ‘CAMLAB.XML’.
      • Reader process removes data file ‘CAMLAB.XML’.
      • Reader process removes handshake file ‘CAMLAB.XMR’.

       

      My question is: What would be the preferred "fuse-ESB-way" to implemented such a behaviour? Would file2 be able to support these requirements? If not, is it possible (and would it make sense) to extend the file2 EIP component to fulfill the requirements above or would i have to write my own new EIP component?

       

      I would prefer to reuse as much as possible of file2 in such a case...

       

      Thanks in advance for any kind of help,

      Mirko