Uploaded image for project: 'JBeret'
  1. JBeret
  2. JBERET-110

Support scripting in chunk reader, processor & writer

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 1.1.0.Alpha3
    • 1.0.2.Final
    • jberet-core
    • None

      Batch applications should be able to write chunk reader, writer & processor in common script languages.

      • javascript
      • groovy
      • ruby
      • python
      • scala
      • php
      • R language for statistical computing

      Scripting chunk reader, writer, or processor can be handy for writing simple steps, including no-op ones. For example,

      <processor>
        <script type="javascript" src="foo.js"></script>
      </processor>
      
      <!-- or with embedded script in job xml -->
      
      <writer>
        <script type="javascript">
          <![CDATA[
              ...code...
          ]]>
        </script>
      </writer>
      

      An ItemReader script must implement readItem function, or another function mapped to readItem method. Other methods from ItemReader interface (open, close, checkpointInfo) may be omitted, if nothing needs to be done there.

      An ItemProcessor script must implement processItem function, or another function mapped to processItem method.

      An ItemWriter script must implement writeItems function, or another function mapped to writeItems method. Other methods from ItemWriter interface (open, close, checkpointInfo) may be omitted, if nothing needs to be done there.

      An example of mapping script function named differently to batch API methods (e.g., readItem => myReadItem):
      https://github.com/jberet/jsr352/blob/master/test-apps/scripting/src/main/resources/META-INF/batch-jobs/chunkPython.xml

              cfang@redhat.com Cheng Fang
              cfang@redhat.com Cheng Fang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: