Class AvroItemWriter<T>
java.lang.Object
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemWriter<T>
org.springframework.batch.item.avro.AvroItemWriter<T>
- All Implemented Interfaces:
ItemStream,ItemStreamWriter<T>,ItemWriter<T>
An
ItemWriter that serializes data to an WritableResource using Avro.
This does not support restart on failure.
This writer is not thread-safe.
- Since:
- 4.2
- Author:
- David Turanski, Mahmoud Ben Hassine
-
Constructor Summary
ConstructorsConstructorDescriptionAvroItemWriter(org.springframework.core.io.WritableResource resource, Class<T> clazz) This constructor will create an ItemWriter that does not embedded Avro schema.AvroItemWriter(org.springframework.core.io.WritableResource resource, org.springframework.core.io.Resource schema, Class<T> clazz) -
Method Summary
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, getName, setExecutionContextName, setName, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.batch.item.ItemStream
update
-
Constructor Details
-
AvroItemWriter
public AvroItemWriter(org.springframework.core.io.WritableResource resource, org.springframework.core.io.Resource schema, Class<T> clazz) - Parameters:
resource- aWritableResourceto which the objects will be serialized.schema- aResourcecontaining the Avro schema.clazz- the data type to be serialized.
-
AvroItemWriter
This constructor will create an ItemWriter that does not embedded Avro schema.- Parameters:
resource- aWritableResourceto which the objects will be serialized.clazz- the data type to be serialized.
-
-
Method Details
-
write
Description copied from interface:ItemWriterProcess the supplied data element. Will not be called with any null items in normal operation.- Parameters:
items- of items to be written. Must not benull.- Throws:
Exception- if there are errors. The framework will catch the exception and convert or rethrow it as appropriate.
-
open
Description copied from class:ItemStreamSupportNo-op.- Specified by:
openin interfaceItemStream- Overrides:
openin classItemStreamSupport- Parameters:
executionContext- current step'sExecutionContext. Will be the executionContext from the last run of the step on a restart.- See Also:
-
close
public void close()Description copied from class:ItemStreamSupportNo-op.- Specified by:
closein interfaceItemStream- Overrides:
closein classItemStreamSupport- See Also:
-