Class FileBlobMessageProducer
- java.lang.Object
-
- org.nuxeo.lib.stream.pattern.producer.AbstractProducer<BlobMessage>
-
- org.nuxeo.importer.stream.producer.FileBlobMessageProducer
-
- All Implemented Interfaces:
AutoCloseable
,Iterator<BlobMessage>
,ProducerIterator<BlobMessage>
public class FileBlobMessageProducer extends AbstractProducer<BlobMessage>
Use a listing file to generate BlobMessage.- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description protected String
basePath
protected long
count
protected Iterator<String>
fileIterator
protected Stream<String>
lines
protected File
listFile
protected long
nbBlobs
-
Fields inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
producerId
-
-
Constructor Summary
Constructors Constructor Description FileBlobMessageProducer(int producerId, File listFile, String basePath, long nbBlobs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
getFileIterator()
int
getPartition(BlobMessage message, int partitions)
Returns a partition associated with theMessage
.boolean
hasNext()
BlobMessage
next()
-
Methods inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
getProducerId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Methods inherited from interface org.nuxeo.lib.stream.pattern.producer.ProducerIterator
remove
-
-
-
-
Constructor Detail
-
FileBlobMessageProducer
public FileBlobMessageProducer(int producerId, File listFile, String basePath, long nbBlobs)
-
-
Method Detail
-
getFileIterator
protected void getFileIterator()
-
getPartition
public int getPartition(BlobMessage message, int partitions)
Description copied from interface:ProducerIterator
Returns a partition associated with theMessage
. The value returned must be between 0 and lower than partitions.- Parameters:
message
- the message to shardpartitions
- the number of partitions
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractProducer<BlobMessage>
- Throws:
Exception
-
hasNext
public boolean hasNext()
-
next
public BlobMessage next()
-
-