
META-INF.batch-jobs.chunkRuby.xml Maven / Gradle / Ivy
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2014 Red Hat, Inc. and/or its affiliates. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0 --> <job id="chunkRuby" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/jobXML_1_0.xsd" version="1.0"> <step id="chunkRuby.step1"> <chunk item-count="3"> <reader> <properties> <property name="resource" value="#{systemProperties['java.io.tmpdir']}/numbers.csv"/> <!-- open and close are built-in functions in Ruby, so need to map batch API's open & close methods to some other names to avoid overriding ruby built-in functions. The following methodMapping property maps batch API's open method to openBatch function in the src script. --> <property name="methodMapping" value="open=openBatchReader, close=closeBatchReader"/> </properties> <script type="jruby" src="ruby/item-reader.rb"/> </reader> <processor> <script type="jruby"> <![CDATA[ #access built-in variables: jobContext, stepContext and batchProperties, #set job exit status to the value of testName property. # def processItem(item) puts('In processItem(), jobName: ' + $jobContext.getJobName() + ', stepName: ' + $stepContext.getStepName()) puts(item) testName = $batchProperties.get('testName') $jobContext.setExitStatus(testName) return item end ]]> </script> </processor> <writer> <properties> <property name="methodMapping" value="open=openBatchWriter, close=closeBatchWriter"/> </properties> <script type="jruby"> <![CDATA[ def openBatchWriter(checkpoint) puts('In writer open') end def closeBatchWriter() puts('In writer close') end def writeItems(items) puts('items to write: ') puts(items) end ]]> </script> </writer> </chunk> <end on="*" exit-status="chunkRuby"/> </step> </job>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy