Package org.nuxeo.lib.stream.pattern
Class KeyValueMessage
- java.lang.Object
-
- org.nuxeo.lib.stream.pattern.KeyValueMessage
-
- All Implemented Interfaces:
Externalizable,Serializable,Message
public class KeyValueMessage extends Object implements Message
Simple key value message.- Since:
- 9.1
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanforceBatchprotected Stringkeystatic KeyValueMessagePOISON_PILLprotected booleanpoisonPillprotected byte[]value
-
Constructor Summary
Constructors Modifier Constructor Description KeyValueMessage()protectedKeyValueMessage(String key, byte[] value, boolean poisonPill, boolean forceBatch)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)booleanforceBatch()A consumer reading this message must not wait for new message to process the batch.StringgetId()A message identifier.inthashCode()Stringkey()static KeyValueMessageof(String key)static KeyValueMessageof(String key, byte[] value)static KeyValueMessageofForceBatch(String key)static KeyValueMessageofForceBatch(String key, byte[] value)A message that force the batch.booleanpoisonPill()This message is a poison pill it contains no other data, a consumer reading this message will process the batch and stop.voidreadExternal(ObjectInput in)StringtoString()byte[]value()voidwriteExternal(ObjectOutput out)
-
-
-
Field Detail
-
POISON_PILL
public static final KeyValueMessage POISON_PILL
-
key
protected String key
-
value
protected byte[] value
-
poisonPill
protected boolean poisonPill
-
forceBatch
protected boolean forceBatch
-
-
Constructor Detail
-
KeyValueMessage
public KeyValueMessage()
-
KeyValueMessage
protected KeyValueMessage(String key, byte[] value, boolean poisonPill, boolean forceBatch)
-
-
Method Detail
-
of
public static KeyValueMessage of(String key, byte[] value)
-
of
public static KeyValueMessage of(String key)
-
ofForceBatch
public static KeyValueMessage ofForceBatch(String key, byte[] value)
A message that force the batch.
-
ofForceBatch
public static KeyValueMessage ofForceBatch(String key)
-
key
public String key()
-
value
public byte[] value()
-
poisonPill
public boolean poisonPill()
Description copied from interface:MessageThis message is a poison pill it contains no other data, a consumer reading this message will process the batch and stop.- Specified by:
poisonPillin interfaceMessage
-
forceBatch
public boolean forceBatch()
Description copied from interface:MessageA consumer reading this message must not wait for new message to process the batch.- Specified by:
forceBatchin interfaceMessage
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
-