public class AvroItemWriter<T> extends AbstractItemStreamItemWriter<T>
ItemWriter
that serializes data to an WritableResource
using Avro.
This does not support restart on failure.Constructor and Description |
---|
AvroItemWriter(org.springframework.core.io.WritableResource resource,
java.lang.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,
java.lang.Class<T> clazz) |
Modifier and Type | Method and Description |
---|---|
void |
close()
No-op.
|
void |
open(ExecutionContext executionContext)
No-op.
|
void |
write(java.util.List<? extends T> items)
Process the supplied data element.
|
getExecutionContextKey, setExecutionContextName, setName, update
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
update
public AvroItemWriter(org.springframework.core.io.WritableResource resource, org.springframework.core.io.Resource schema, java.lang.Class<T> clazz)
resource
- a WritableResource
to which the objects will be serialized.schema
- a Resource
containing the Avro schema.clazz
- the data type to be serialized.public AvroItemWriter(org.springframework.core.io.WritableResource resource, java.lang.Class<T> clazz)
resource
- a WritableResource
to which the objects will be serialized.clazz
- the data type to be serialized.public void write(java.util.List<? extends T> items) throws java.lang.Exception
ItemWriter
items
- items to be writtenjava.lang.Exception
- if there are errors. The framework will catch the
exception and convert or rethrow it as appropriate.public void open(ExecutionContext executionContext)
ItemStreamSupport
open
in interface ItemStream
open
in class ItemStreamSupport
executionContext
- current step's ExecutionContext
. Will be the
executionContext from the last run of the step on a restart.ItemStream.open(ExecutionContext)
public void close()
ItemStreamSupport
close
in interface ItemStream
close
in class ItemStreamSupport
ItemStream.close()