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 intaverageSizeKBprotected longcountprotected static StringDEFAULT_MIME_TYPEprotected static RandomTextGeneratorgenprotected Stringmarkerprotected Stringmimetypeprotected longnbBlobsprotected ThreadLocalRandomrand-
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 StringgenerateContent()protected StringgenerateFilename()intgetPartition(BlobMessage message, int partitions)Returns a partition associated with theMessage.booleanhasNext()BlobMessagenext()-
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
-
count
protected long count
-
gen
protected static RandomTextGenerator gen
-
-
Constructor Detail
-
RandomStringBlobMessageProducer
public RandomStringBlobMessageProducer(int producerId, long nbBlobs, String lang, int averageSizeKB, String marker)
-
-
Method Detail
-
getPartition
public int getPartition(BlobMessage message, int partitions)
Description copied from interface:ProducerIteratorReturns 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()
-
-