Class RedisDocumentMessageConsumer
- java.lang.Object
-
- org.nuxeo.lib.stream.pattern.consumer.AbstractConsumer<DocumentMessage>
-
- org.nuxeo.importer.stream.consumer.RedisDocumentMessageConsumer
-
- All Implemented Interfaces:
AutoCloseable,Consumer<DocumentMessage>
public class RedisDocumentMessageConsumer extends AbstractConsumer<DocumentMessage>
Consumes DocumentMessage and send them to Redis which can be used as Gatling feeder.- Since:
- 10.2
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]addDocumentSHAprotected static StringBATCH_ID_TAGprotected static StringDATA_KEY_SUFFIXprotected static StringDEFAULT_REDIS_PREFIXprotected static StringDOC_KEY_SUFFIXprotected static StringFOLDER_KEY_SUFFIXprotected static com.fasterxml.jackson.databind.ObjectMapperOBJECT_MAPPERprotected RedisExecutorredisExecutorprotected StringredisPrefix-
Fields inherited from class org.nuxeo.lib.stream.pattern.consumer.AbstractConsumer
consumerId
-
-
Constructor Summary
Constructors Constructor Description RedisDocumentMessageConsumer(String consumerId, String redisPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(DocumentMessage message)Consume a message.voidbegin()Begin a batch of messages.protected byte[]bytes(String val)voidcommit()End of the batch message.protected StringgetPayload(DocumentMessage message, String properties)protected StringgetProperties(DocumentMessage message)protected StringgetPropertiesWithBlob(DocumentMessage message)voidrollback()Called when there is an exception duringConsumer.accept(Message)orConsumer.commit().-
Methods inherited from class org.nuxeo.lib.stream.pattern.consumer.AbstractConsumer
close, getConsumerId
-
-
-
-
Field Detail
-
DEFAULT_REDIS_PREFIX
protected static final String DEFAULT_REDIS_PREFIX
- See Also:
- Constant Field Values
-
DOC_KEY_SUFFIX
protected static final String DOC_KEY_SUFFIX
- See Also:
- Constant Field Values
-
DATA_KEY_SUFFIX
protected static final String DATA_KEY_SUFFIX
- See Also:
- Constant Field Values
-
FOLDER_KEY_SUFFIX
protected static final String FOLDER_KEY_SUFFIX
- See Also:
- Constant Field Values
-
BATCH_ID_TAG
protected static final String BATCH_ID_TAG
- See Also:
- Constant Field Values
-
OBJECT_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
-
addDocumentSHA
protected final byte[] addDocumentSHA
-
redisExecutor
protected final RedisExecutor redisExecutor
-
redisPrefix
protected final String redisPrefix
-
-
Method Detail
-
accept
public void accept(DocumentMessage message)
Description copied from interface:ConsumerConsume a message.
-
getPayload
protected String getPayload(DocumentMessage message, String properties)
-
getPropertiesWithBlob
protected String getPropertiesWithBlob(DocumentMessage message)
-
getProperties
protected String getProperties(DocumentMessage message) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
bytes
protected byte[] bytes(String val)
-
begin
public void begin()
Description copied from interface:ConsumerBegin a batch of messages.
-
commit
public void commit()
Description copied from interface:ConsumerEnd of the batch message.
-
rollback
public void rollback()
Description copied from interface:ConsumerCalled when there is an exception duringConsumer.accept(Message)orConsumer.commit().
-
-