Class ImmutableMessageRecordValue
java.lang.Object
io.camunda.zeebe.protocol.record.value.ImmutableMessageRecordValue
- All Implemented Interfaces:
JsonSerializable,RecordValue,RecordValueWithVariables,MessageRecordValue
@ParametersAreNonnullByDefault
@Immutable
public final class ImmutableMessageRecordValue
extends Object
implements MessageRecordValue
Immutable implementation of
MessageRecordValue.
Use the builder to create immutable instances:
ImmutableMessageRecordValue.builder().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableMessageRecordValue. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forImmutableMessageRecordValue.static ImmutableMessageRecordValuecopyOf(MessageRecordValue instance) Creates an immutable copy of aMessageRecordValuevalue.booleanThis instance is equal to all instances ofImmutableMessageRecordValuethat have equal attribute values.longThe ID of a message is an optional field which is used to make messages unique and prevent publishing the same message twice during its lifetime.getName()longinthashCode()Returns a lazily computed hash code from attributes:variables,name,correlationKey,messageId,timeToLive,deadline.toString()Prints the immutable valueMessageRecordValuewith attribute values.withCorrelationKey(String value) Copy the current immutable object by setting a value for thecorrelationKeyattribute.withDeadline(long value) Copy the current immutable object by setting a value for thedeadlineattribute.withMessageId(String value) Copy the current immutable object by setting a value for themessageIdattribute.Copy the current immutable object by setting a value for thenameattribute.withTimeToLive(long value) Copy the current immutable object by setting a value for thetimeToLiveattribute.withVariables(Map<String, ? extends Object> entries) Copy the current immutable object by replacing thevariablesmap with the specified map.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.camunda.zeebe.protocol.record.JsonSerializable
toJson
-
Method Details
-
getVariables
- Specified by:
getVariablesin interfaceRecordValueWithVariables- Returns:
- the variables of this record. Can be empty.
-
getName
- Specified by:
getNamein interfaceMessageRecordValue- Returns:
- the name of the message
-
getCorrelationKey
- Specified by:
getCorrelationKeyin interfaceMessageRecordValue- Returns:
- the correlation key of the message
-
getMessageId
The ID of a message is an optional field which is used to make messages unique and prevent publishing the same message twice during its lifetime.- Specified by:
getMessageIdin interfaceMessageRecordValue- Returns:
- the id of the message
-
getTimeToLive
public long getTimeToLive()- Specified by:
getTimeToLivein interfaceMessageRecordValue- Returns:
- the time to live of the message
-
getDeadline
public long getDeadline()- Specified by:
getDeadlinein interfaceMessageRecordValue- Returns:
- the unix timestamp in milliseconds until when the message can be correlated. If the deadline is exceeded then the message expires and will be removed. If this property is not set, it returns -1 instead.
-
withVariables
Copy the current immutable object by replacing thevariablesmap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the variables map- Returns:
- A modified copy of
thisobject
-
withName
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name (can benull)- Returns:
- A modified copy of the
thisobject
-
withCorrelationKey
Copy the current immutable object by setting a value for thecorrelationKeyattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for correlationKey (can benull)- Returns:
- A modified copy of the
thisobject
-
withMessageId
Copy the current immutable object by setting a value for themessageIdattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for messageId (can benull)- Returns:
- A modified copy of the
thisobject
-
withTimeToLive
Copy the current immutable object by setting a value for thetimeToLiveattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for timeToLive- Returns:
- A modified copy of the
thisobject
-
withDeadline
Copy the current immutable object by setting a value for thedeadlineattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for deadline- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofImmutableMessageRecordValuethat have equal attribute values. -
hashCode
public int hashCode()Returns a lazily computed hash code from attributes:variables,name,correlationKey,messageId,timeToLive,deadline. -
toString
Prints the immutable valueMessageRecordValuewith attribute values. -
copyOf
Creates an immutable copy of aMessageRecordValuevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable MessageRecordValue instance
-
builder
Creates a builder forImmutableMessageRecordValue.ImmutableMessageRecordValue.builder() .putVariable|putAllVariables(String => Object) //variablesmappings .withName(String | null) // nullablename.withCorrelationKey(String | null) // nullablecorrelationKey.withMessageId(String | null) // nullablemessageId.withTimeToLive(long) // optionaltimeToLive.withDeadline(long) // optionaldeadline.build();- Returns:
- A new ImmutableMessageRecordValue builder
-