Topic
  • 3 replies
  • Latest Post - ‏2012-11-05T22:05:21Z by Veluri
Veluri
Veluri
31 Posts

Pinned topic Same Output Stream for all Job steps

‏2012-10-25T22:26:35Z |
Hi All:
I have situation like

My previous step has outputstream1(Logical Name) ---Pattern implements by class1

Class1 does just merge the entity
My next step want use to same class1 to implement another outputstream2(Logical Name) ....

is it possible?
If yes how I need to define my xJCL.
My next step is throwing null exception since my previous step destroy method is closing the stream and freeing the resouce.
Thank you
Murali
Updated on 2012-11-05T22:05:21Z at 2012-11-05T22:05:21Z by Veluri
  • sspavan
    sspavan
    60 Posts

    Re: Same Output Stream for all Job steps

    ‏2012-10-29T23:13:22Z  
    You can use the same implementation class.
    Here I use same TextFileWriter for 2 different outputstreams.

    <job-step name="splitJob">
    <classname>com.bcbsks.test.FileSplitter</classname>
    <checkpoint-algorithm-ref name="chkpt"/>
    <batch-data-streams>
    <bds>
    <logical-name>inputStream</logical-name>
    <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.TextFileReader</impl-class>
    <props>
    <prop name="FILENAME" value="c:/javabatch-testfiles/spliter-input.txt"/>
    <prop name="PATTERN_IMPL_CLASS" value="com.test.TextFileReader"/>
    <prop name="debug" value="false"/>
    <prop name="file.encoding" value="8859_1"/>
    <prop name="EnableDetailedPerformanceMeasurement" value="true"/>
    <prop name="EnablePerformanceMeasurement" value="true"/>
    <prop name="AppendJobldToFileName" value="false"/>
    </props>
    </bds>
    <bds>
    <logical-name>outputStream1</logical-name>
    <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.TextFileWriter</impl-class>
    <props>
    <prop name="FILENAME" value="c:/javabatch-testfiles/splitter-output1.txt"/>
    <prop name="PATTERN_IMPL_CLASS" value="com.test.TextFileWriter"/>
    <prop name="debug" value="false"/>
    <prop name="EnableDetailedPerformanceMeasurement" value="true"/>
    <prop name="EnablePerformanceMeasurement" value="true"/>
    <prop name="AppendJobldToFileName" value="false"/>
    <prop name="file.encoding" value="8859_1"/>
    </props>
    </bds>
    <bds>
    <logical-name>outputStream2</logical-name>
    <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.TextFileWriter</impl-class>
    <props>
    <prop name="FILENAME" value="c:/javabatch-testfiles/splitter-output2.txt"/>
    <prop name="PATTERN_IMPL_CLASS" value="com.test.TextFileWriter"/>
    <prop name="debug" value="false"/>
    <prop name="EnableDetailedPerformanceMeasurement" value="true"/>
    <prop name="EnablePerformanceMeasurement" value="true"/>
    <prop name="AppendJobldToFileName" value="false"/>
    <prop name="file.encoding" value="8859_1"/>
    </props>
    </bds>
    </batch-data-streams>
    <props>
    <prop name="debug" value="false"/>
    </props>
    <results-ref name="rslt"/>
    </job-step>
  • sspavan
    sspavan
    60 Posts

    Re: Same Output Stream for all Job steps

    ‏2012-10-29T23:15:35Z  
    • sspavan
    • ‏2012-10-29T23:13:22Z
    You can use the same implementation class.
    Here I use same TextFileWriter for 2 different outputstreams.

    <job-step name="splitJob">
    <classname>com.bcbsks.test.FileSplitter</classname>
    <checkpoint-algorithm-ref name="chkpt"/>
    <batch-data-streams>
    <bds>
    <logical-name>inputStream</logical-name>
    <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.TextFileReader</impl-class>
    <props>
    <prop name="FILENAME" value="c:/javabatch-testfiles/spliter-input.txt"/>
    <prop name="PATTERN_IMPL_CLASS" value="com.test.TextFileReader"/>
    <prop name="debug" value="false"/>
    <prop name="file.encoding" value="8859_1"/>
    <prop name="EnableDetailedPerformanceMeasurement" value="true"/>
    <prop name="EnablePerformanceMeasurement" value="true"/>
    <prop name="AppendJobldToFileName" value="false"/>
    </props>
    </bds>
    <bds>
    <logical-name>outputStream1</logical-name>
    <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.TextFileWriter</impl-class>
    <props>
    <prop name="FILENAME" value="c:/javabatch-testfiles/splitter-output1.txt"/>
    <prop name="PATTERN_IMPL_CLASS" value="com.test.TextFileWriter"/>
    <prop name="debug" value="false"/>
    <prop name="EnableDetailedPerformanceMeasurement" value="true"/>
    <prop name="EnablePerformanceMeasurement" value="true"/>
    <prop name="AppendJobldToFileName" value="false"/>
    <prop name="file.encoding" value="8859_1"/>
    </props>
    </bds>
    <bds>
    <logical-name>outputStream2</logical-name>
    <impl-class>com.ibm.websphere.batch.devframework.datastreams.patterns.TextFileWriter</impl-class>
    <props>
    <prop name="FILENAME" value="c:/javabatch-testfiles/splitter-output2.txt"/>
    <prop name="PATTERN_IMPL_CLASS" value="com.test.TextFileWriter"/>
    <prop name="debug" value="false"/>
    <prop name="EnableDetailedPerformanceMeasurement" value="true"/>
    <prop name="EnablePerformanceMeasurement" value="true"/>
    <prop name="AppendJobldToFileName" value="false"/>
    <prop name="file.encoding" value="8859_1"/>
    </props>
    </bds>
    </batch-data-streams>
    <props>
    <prop name="debug" value="false"/>
    </props>
    <results-ref name="rslt"/>
    </job-step>
    FYI..

    I used the same Writer Impl class in one step for multiple output streams and also across multiple steps, and code works fine without issues.
  • Veluri
    Veluri
    31 Posts

    Re: Same Output Stream for all Job steps

    ‏2012-11-05T22:05:21Z  
    Thanks for all your support
    Your ideas are helping me a lot.