6 Replies Latest reply on Nov 8, 2017 7:57 AM by mistrz_7

    Solution architecture

    mistrz_7

      Hello,

      I have general question about jbatch architecture solution for required app. This batch should:

      1. delete/truncate table on db1

      2. load to table from point 1 data from db2

      3. execute sql on db1 (using table from point 1) and return results to db2

       

      I have problem on 1 point. How to delete or better truncate table using jberet? I cant do it using jdbcItemReader->jdbcItemWriter becouse no result set is returned. I tried to create batchlet that call dao but then I got "no transaction exception". Point 2 i 3 looks like easy to make.

      Mayby my all idea is bad. Mayby I should do this proces in other way?

       

      Thanks for sugestions

      Regards

      sw

        • 1. Re: Solution architecture
          cfang

          have you tried jdbcBatchlet (org.jberet.support.io.JdbcBatchlet), the batch artifact from jberet-support?  For example usage in a sample app, see intro-jberet/csv2db.xml at master · jberet/intro-jberet · GitHub

           

          In the above job xml, the first of the two steps prepares the output table: creates the table if not exist, and then delete the table content.  The jdbcBathlet is configured to run 2 sql statements sequentially.

           

          Your task 1 looks like a one-time task so doesn't fit with the chunk-based reader-process-writer pattern.

          • 2. Re: Solution architecture
            mistrz_7

            Is jdbcBatchlet availble since 1.3?

            • 3. Re: Solution architecture
              cfang

              yes, it's available since jberet-support 1.3.0.Beta5.

               

              It should also work with earlier versions of jberet-core as well.

              • 4. Re: Solution architecture
                mistrz_7

                Hello,

                 

                It works to with 1.3.0.Beta6, so I'm waiting for a final release:)

                 

                I have got one addition question about logging. In standard environment jdbcBatchlet log statement that will be executed like:

                JBERET060506: Adding sql statement to be executed: truncate table t_my_table

                But standard jdbcItemReader and jdbcItemWriter logs nothing. How to change it?

                • 5. Re: Solution architecture
                  cfang

                  As far as jberet-support is concerned, 1.3.0.Beta6 is already pretty stable, and 1.3.0.Final will not be much different.

                   

                  jdbcBatchlet is one-time task, so logging the statements is cheap, whereas jdbcItemReader and jdbcItemWriter repeat their logic and so logging each time will end up being too verbose.  It's not practical to log the data item(s) being read or written, since one such data item can be sizable, let alone chunks of them.  As for the other metrics, they are available from step metrics.

                  • 6. Re: Solution architecture
                    mistrz_7

                    You are right, but it would be nice to know that pair reader-processor-writer has been started. Now I always start it with batchlet with on flow. This batchlet only logs events like 'start loading from ...'.

                     

                    Regards

                    sw