Note that there are some explanatory texts on larger screens.

plurals
  1. POPatterns for this type of problem
    primarykey
    data
    text
    <p>I need advise regarding the pattern to use for the following problem.</p> <p>There are many rows -- let us call it messages(identified by MSG_ID in DB)-- in a table which corresponds to a file. Means, the file has been split into many pieces and put into database.</p> <p>So parts corresponding to file can be identified using a GROUP_ID column, and MSG_ID corresponds to individual message. The primary key is a combination of GROUP_ID and MSG_ID.</p> <p>Now, each message consists of n number of logical records(which are typically payment instructions(k x 128 bytes of data)). Where current reading payment instruction ends can be said only after reading the next 128 characters. Also parts of a payment instruction can be in consecutive messages. Which means a complete payment instruction can be spread across end of MSG_ID n and start of MSG_ID n+1.</p> <p>We are using spring batch to do the processing.</p> <p>I have tried querying the table and writing all the records to a flat file one by one and start the spring batch from there.</p> <p>I would like to know whether there's any pattern which I can use to achieve the requirement without using a flat file.</p> <p>Like,</p> <ol> <li><p>Read MSG_ID 1 and GROUP_ID "ABC" from db</p></li> <li><p>Seperate the payment instructions and give each instruction to the processor.</p></li> <li><p>When end of MSG_ID 1 is reached check whether the final record in hand form a Payment Instruction, if not read MSG_ID 2 and GROUP_ID "ABC" and append to the previous left over record.</p></li> <li><p>Read till MSG_ID==N where N is known before starting the read process.</p></li> <li><p>Is there any ItemReaders in Spring or Iterator patterns in java which I can use ?</p></li> </ol> <p>To be more clear, there are patterns for handling, "IF your logical record is spread in multiple rows". Is there any pattern for "IF one row in DB contains 'M' number logical records, where M may not be an integer, use this type of Iterator or ItemReaders"</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload