Class RandomStringBlobMessageProducer
- java.lang.Object
-
- org.nuxeo.lib.stream.pattern.producer.AbstractProducer<BlobMessage>
-
- org.nuxeo.importer.stream.producer.RandomStringBlobMessageProducer
-
- All Implemented Interfaces:
AutoCloseable
,Iterator<BlobMessage>
,ProducerIterator<BlobMessage>
public class RandomStringBlobMessageProducer extends AbstractProducer<BlobMessage>
Build random StringBlob message.- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description protected int
averageSizeKB
protected long
count
protected static String
DEFAULT_MIME_TYPE
protected static RandomTextGenerator
gen
protected String
marker
protected String
mimetype
protected long
nbBlobs
protected ThreadLocalRandom
rand
-
Fields inherited from class org.nuxeo.lib.stream.pattern.producer.AbstractProducer
producerId
-
-
Constructor Summary
Constructors Constructor Description RandomStringBlobMessageProducer(int producerId, long nbBlobs, String lang, int averageSizeKB, String marker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
generateContent()
protected String
generateFilename()
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
close, 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
-
-
-
-
Field Detail
-
DEFAULT_MIME_TYPE
protected static final String DEFAULT_MIME_TYPE
- See Also:
- Constant Field Values
-
nbBlobs
protected final long nbBlobs
-
averageSizeKB
protected final int averageSizeKB
-
rand
protected final ThreadLocalRandom rand
-
marker
protected final String marker
-
count
protected long count
-
gen
protected static RandomTextGenerator gen
-
mimetype
protected final String mimetype
-
-
Method Detail
-
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
-
hasNext
public boolean hasNext()
-
next
public BlobMessage next()
-
generateFilename
protected String generateFilename()
-
generateContent
protected String generateContent()
-
-