Note: a generated documentation is available here: generated documentation page.
org.apache.batchee.extras.locator.BeanLocator
Each time an implementation/reference needs to be resolved this API is used. The default one respects the same rules as the implementation used to resolve ref attributes of the batch xml file (it means you can use qualified names, CDI names if you are in a CDI container...).
Readers, writers, processors have always a shortname which will only work with batchee implementation. To use it with other JBatch implementation use the full qualified name.
org.apache.batchee.extras.chain.ChainProcessor
Allow to set multiple javax.batch.api.chunk.ItemProcessor
through a single processor. The n+1 processor processes the returned value of the n processor.
Sample:
Note: org.apache.batchee.extras.chain.ChainBatchlet
does the same for javax.batch.api.Batchlet
.
Shortname: chainProcessor
org.apache.batchee.extras.flat.FlatFileItemReader
A reader reading line by line a file. By default the line is returned as a java.lang.String
. To return another object just override protected Object preReturn(String line, long lineNumber)
method:
Sample:
Configuration:
BeanLocator
used to find the lineMapperorg.apache.batchee.extras.flat.LineMapper
. If noone is provided the read object will be the line (as a String
)Shortname: flatReader
org.apache.batchee.extras.flat.FlatFileItemWriter
A writer writing an item by line. By default toString()
is used on items, to change it just override protected String preWrite(Object object)
method:
Sample:
Configuration:
Shortname: flatWriter
org.apache.batchee.extras.jdbc.JdbcBatchlet
A simple Batchlet
to execute sql.
Sample:
Configuration:
Shortname: jdbcBatchlet
org.apache.batchee.extras.jdbc.JdbcReader
This reader execute a query while the query returns items.
Sample:
Configuration:
org.apache.batchee.extras.jdbc.RecordMapper
to use to convert java.sql.ResultSet
to objectsorg.apache.batchee.extras.locator.BeanLocator
to use to create the mapperHere is a sample record mapper deleting items once read (Note: you probably don't want to do so or at least not without a managed datasource):
Shortname: jdbcReader
org.apache.batchee.extras.jdbc.JdbcWriter
A writer storing items in a database.
Sample:
Configuration:
org.apache.batchee.extras.jdbc.ObjectMapper
to use to convert objects to JDBC through java.sql.PreparedStatement
org.apache.batchee.extras.locator.BeanLocator
to use to create the mapperHere is a sample object mapper:
Shortname: jdbcWriter
org.apache.batchee.extras.jpa.JpaItemReader
Reads items from a JPA query.
Sample:
Configuration:
org.apache.batchee.extras.jpa.EntityManagerProvider
(BeanLocator
semantic), note you can set a jndi name if the value starts with jndi (for instance jndi:java:comp/env/em).org.apache.batchee.extras.jpa.ParameterProvider
(BeanLocator
semantic)org.apache.batchee.extras.locator.BeanLocator
used to create org.apache.batchee.extras.jpa.EntityManagerProvider
and org.apache.batchee.extras.jpa.ParameterProvider
Shortname: jpaReader
org.apache.batchee.extras.jpa.JpaItemWriter
Write items through JPA API.
Sample:
Configuration:
org.apache.batchee.extras.jpa.EntityManagerProvider
(BeanLocator
semantic), note you can set a jndi name if the value starts with jndi (for instance jndi:java:comp/env/em).org.apache.batchee.extras.locator.BeanLocator
used to create org.apache.batchee.extras.jpa.EntityManagerProvider
Shortname: jpaWriter
org.apache.batchee.extras.noop.NoopItemWriter
A writer doing nothing (in a writer is mandatory so it can mock one if you don't need one).
Sample:
Shortname: noopWriter
org.apache.batchee.extras.typed.Typed[Reader|Processor|Writer]
Just abstract class allowing to use typed items instead of Object
from the JBatch API.
org.apache.batchee.extras.stax.StaxItemReader
A reader using StAX API to read a XML file.
Sample:
Configuration:
Shortname: staxReader
org.apache.batchee.extras.stax.StaxItemWriter
A writer using StAX API to write a XML file.
Sample:
Configuration:
Shortname: staxWriter
org.apache.batchee.beanio.BeanIOReader
A reader using BeanIO.
Sample:
Here is the associated beanio.xml:
Configuration:
Shortname: beanIOReader
org.apache.batchee.beanio.BeanIOWriter
A writer using BeanIO.
Sample:
Configuration:
org.apache.batchee.camel.CamelTemplateLocator
to find the org.apache.camel.ProducerTemplate
to useShortname: beanIOWriter
org.apache.batchee.camel.CamelItemProcessor
A processor reusing Camel logic.
Sample:
Configuration:
org.apache.batchee.camel.CamelTemplateLocator
to find the org.apache.camel.ProducerTemplate
to useShortname: camelProcessor
org.apache.batchee.camel.CamelChainItemProcessor
Same as previous one but with a chain
Sample:
Configuration: mainly the chain configuration excepted “chain” value is a list of endpoints.
Shortname: camelChainProcessor
org.apache.batchee.camel.CamelItemReader
A reader using camel consumers.
Sample:
Configuration:
org.apache.batchee.camel.CamelTemplateLocator
to find the org.apache.camel.ConsumerTemplate
to useShortname: camelReader
org.apache.batchee.camel.CamelItemWriter
A writer using camel producer.
Sample:
Configuration:
org.apache.batchee.camel.CamelTemplateLocator
to find the org.apache.camel.ProducerTemplate
to useShortname: camelWriter
batchee-camel includes a Camel component. Here is its format:
jbatch:name[?synchronous=xxx]
with name the batch name. By default it is not intended to be synchronous but it can be forced (by polling) using synchronous attribute. Synchronous attribute is the polling period and needs to be > 0 to be active.
After this endpoint (even in asynchrnous mode) the exchange will get the headers:
Note: if you set JBatchExecutionId in the headers before this endpoint you can use ?restart=true or ?stop=true or ?abandon=true to restart/stop/abandon the job instead of starting it.
org.apache.batchee.groovy.GroovyItemReader
A reader delegating to a groovy script.
Sample:
Configuration:
Shortname: groovyReader
org.apache.batchee.groovy.GroovyItemProcessor
A processor delegating to a groovy script.
Sample:
Configuration:
Shortname: groovyProcessor
org.apache.batchee.groovy.GroovyItemWriter
A writer delegating to a groovy script.
Sample:
Configuration:
Shortname: groovyWriter
org.apache.batchee.groovy.GroovyBatchlet
A batchlet delegating to a groovy script.
Sample:
Configuration:
Shortname: groovyBatchlet
org.apache.batchee.extras.validation.BeanValidationItemProcessor
(JSR 330/349)A simple processor validating an item using bean validation.
Sample:
Configuration:
Shortname: beanValidationProcessor
org.apache.batchee.jsefa.JSefaCsvReader
Use JSefa to read a CSV file.
Sample:
Configuration (excepted for file see org.jsefa.csv.config.CsvConfiguration for detail):
org.jsefa.common.config.ValidationMode
org.jsefa.common.lowlevel.filter.LineFilter
org.jsefa.csv.lowlevel.config.CsvLowLevelConfiguration
org.jsefa.common.accessor.ObjectAccessorProvider
org.jsefa.common.converter.provider.SimpleTypeConverterProvider
org.jsefa.common.mapping.TypeMappingRegistry
org.jsefa.common.validator.provider.ValidatorProvider
org.jsefa.csv.lowlevel.config.EscapeMode
Shortname: jsefaCsvReader
org.apache.batchee.jsefa.JSefaCsvWriter
Use JSefa to write a CSV file.
Sample:
Configuration (excepted for file and encoding see org.jsefa.csv.config.CsvConfiguration for detail):
org.jsefa.common.config.ValidationMode
org.jsefa.common.lowlevel.filter.LineFilter
org.jsefa.csv.lowlevel.config.CsvLowLevelConfiguration
org.jsefa.common.accessor.ObjectAccessorProvider
org.jsefa.common.converter.provider.SimpleTypeConverterProvider
org.jsefa.common.mapping.TypeMappingRegistry
org.jsefa.common.validator.provider.ValidatorProvider
org.jsefa.csv.lowlevel.config.EscapeMode
Shortname: jsefaCsvWriter
org.apache.batchee.jsefa.JSefaFlrReader
Use JSefa to read a FLR file.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
org.jsefa.common.config.ValidationMode
org.jsefa.common.lowlevel.filter.LineFilter
org.jsefa.flr.lowlevel.config.FlrLowLevelConfiguration
org.jsefa.common.accessor.ObjectAccessorProvider
org.jsefa.common.converter.provider.SimpleTypeConverterProvider
org.jsefa.common.mapping.TypeMappingRegistry
org.jsefa.common.validator.provider.ValidatorProvider
Shortname: jsefaFlrReader
org.apache.batchee.jsefa.JSefaFlrWriter
Use JSefa to write a FLR file.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
org.jsefa.common.config.ValidationMode
org.jsefa.common.lowlevel.filter.LineFilter
org.jsefa.flr.lowlevel.config.FlrLowLevelConfiguration
org.jsefa.common.accessor.ObjectAccessorProvider
org.jsefa.common.converter.provider.SimpleTypeConverterProvider
org.jsefa.common.mapping.TypeMappingRegistry
org.jsefa.common.validator.provider.ValidatorProvider
Shortname: jsefaFlrWriter
org.apache.batchee.jsefa.JSefaXmlReader
Use JSefa to read a XML file.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
org.jsefa.common.config.ValidationMode
org.jsefa.common.accessor.ObjectAccessorProvider
org.jsefa.common.converter.provider.SimpleTypeConverterProvider
org.jsefa.common.mapping.TypeMappingRegistry
org.jsefa.common.validator.provider.ValidatorProvider
org.jsefa.xml.lowlevel.config.XmlLowLevelConfiguration
org.jsefa.xml.mapping.support.XmlDataTypeDefaultNameRegistry
org.jsefa.xml.namespace.NamespaceManager
Shortname: jsefaXmlReader
org.apache.batchee.jsefa.JSefaXmlWriter
Use JSefa to write a XML file.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
org.jsefa.common.config.ValidationMode
org.jsefa.common.accessor.ObjectAccessorProvider
org.jsefa.common.converter.provider.SimpleTypeConverterProvider
org.jsefa.common.mapping.TypeMappingRegistry
org.jsefa.common.validator.provider.ValidatorProvider
org.jsefa.xml.lowlevel.config.XmlLowLevelConfiguration
org.jsefa.xml.mapping.support.XmlDataTypeDefaultNameRegistry
org.jsefa.xml.namespace.NamespaceManager
Shortname: jsefaXmlWriter
org.apache.batchee.jackson.JacksonJsonReader
Use Jackson to read a JSon file.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
Shortname: jacksonJSonReader
org.apache.batchee.jackson.JacksonJSonWriter
Use Jackson to write a JSon file.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
org.apache.batchee.jackson.FieldNameGenerator
.Shortname: jacksonJSonWriter
org.apache.batchee.modelmapper.ModelMapperItemProcessor
Just a simple item processor mapping input to another type based on ModelMapper library. To customize the modelMapper just override newMapper()
method.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
Shortname: modelMapperProcessor
org.apache.batchee.hazelcast.HazelcastLockBatchlet
A batchlet getting a hazelcast lock.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
HazelcastInstance
is local or remote (ie if the HazelcastInstance
is a member of the cluster or a client)local = true
tryDuration
)Shortname: hazelcastLock
org.apache.batchee.hazelcast.HazelcastUnlockBatchlet
A batchlet releasing a hazelcast lock.
Sample:
Configuration (excepted for file see org.jsefa.flr.config.FlrConfiguration for detail):
HazelcastInstance
is local or remote (ie if the HazelcastInstance
is a member of the cluster or a client)local = true
Shortname: hazelcastUnlock
@org.apache.batchee.cdi.scope.JobScoped
allows you to define a bean scoped to a job execution. @org.apache.batchee.cdi.scope.StepScoped
allows you to define a bean scoped to a step execution.
To activate these scopes you need to define 4 listeners:
org.apache.batchee.cdi.listener.BeforeJobScopeListener
org.apache.batchee.cdi.listener.AfterJobScopeListener
org.apache.batchee.cdi.listener.BeforeStepScopeListener
org.apache.batchee.cdi.listener.AfterStepScopeListener
If your implementation supports ordering on listeners use them to ensure Before*
are executed first and After*
are executed last. This will let you use these scopes in your own listeners. *JobScopeListener
are javax.batch.api.listener.JobListener
and *StepScopeListener
are javax.batch.api.listener.StepListener
.
NB: these listeners are @Named
so you can use their CDI name to reference them (not mandatory)
If the implementation doesn't provide any ordering of the listeners be aware these scopes will only work in steps.
For BatchEE you can add them in batchee.properties
this way: