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 boolean
forceBatch
protected String
key
static KeyValueMessage
POISON_PILL
protected boolean
poisonPill
protected byte[]
value
-
Constructor Summary
Constructors Modifier Constructor Description KeyValueMessage()
protected
KeyValueMessage(String key, byte[] value, boolean poisonPill, boolean forceBatch)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
boolean
forceBatch()
A consumer reading this message must not wait for new message to process the batch.String
getId()
A message identifier.int
hashCode()
String
key()
static KeyValueMessage
of(String key)
static KeyValueMessage
of(String key, byte[] value)
static KeyValueMessage
ofForceBatch(String key)
static KeyValueMessage
ofForceBatch(String key, byte[] value)
A message that force the batch.boolean
poisonPill()
This message is a poison pill it contains no other data, a consumer reading this message will process the batch and stop.void
readExternal(ObjectInput in)
String
toString()
byte[]
value()
void
writeExternal(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:Message
This message is a poison pill it contains no other data, a consumer reading this message will process the batch and stop.- Specified by:
poisonPill
in interfaceMessage
-
forceBatch
public boolean forceBatch()
Description copied from interface:Message
A consumer reading this message must not wait for new message to process the batch.- Specified by:
forceBatch
in interfaceMessage
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
-