Interface RecordMessage
- All Superinterfaces:
Message
- All Known Subinterfaces:
GenericMessage
,RecordType1Message
,RecordType2Message
,RecordType3Message
Base interface for all Record messages.
You do not need to implement this interface. Instead use one of its derived interfaces:
Objects implementing these interfaces cannot be instantiated directly, but can be constructed
using the MessageFactory
that is available on the
Publisher
interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLatencyChainPoint
(String pointName, Instant instant) Adds a latency chain pointvoid
Removes all the fields previously added to thisRecordMessage
boolean
containsField
(String fieldName) Determines whether the message contains the specified fieldGets the value of the specified field.Gets the fields within thisRecordMessage
, in the order of which the fields were sent.void
removeField
(String fieldName) Removes all occurrences given field from thisRecordMessage
.void
Sets a field value.void
setInitialLatencyChainTime
(Instant instant) Starts a latency chain if enabled using the latencyChainManager configuration option.Methods inherited from interface com.caplin.datasource.messaging.Message
getMessageType, getSubject, isImage, setImage
-
Method Details
-
clearFields
void clearFields()Removes all the fields previously added to thisRecordMessage
-
containsField
Determines whether the message contains the specified field- Parameters:
fieldName
- Name of the field.- Returns:
true
if the message contains the field, otherwise,false
.
-
getFields
Gets the fields within thisRecordMessage
, in the order of which the fields were sent. This can include duplicate field names for different values.- Returns:
- A read-only list of the fields.
-
setField
Sets a field value.
If the field does not exist in this
RecordMessage
, the field is added to it. Otherwise the existing occurrence of the field is updated to the newvalue
.- Parameters:
fieldName
- The name of the field.value
- The new value of the field.- Throws:
IllegalArgumentException
- Raised when thefieldName
is not defined in the Fields configuration file.
-
getField
Gets the value of the specified field. If the field does not exist in this
RecordMessage
,null
is returned.- Parameters:
fieldName
- The name of the field to get.- Returns:
- The value of the field with the name
fieldName
, or null if there is no such field in thisRecordMessage
. - Throws:
IllegalArgumentException
- Raised when thefieldName
is not defined in the Fields configuration file.
-
removeField
Removes all occurrences given field from thisRecordMessage
.- Parameters:
fieldName
- The name of the field to remove.
-
setInitialLatencyChainTime
Starts a latency chain if enabled using the latencyChainManager configuration option.
- Parameters:
instant
- The first time in the latency chain as a Java Instant. This could be: the time the data was created; the time the data entered the DataSource adaptor; or the time the data entered the DataSource API. The time is of the same form as the value ofInstant.now()
.- Throws:
IllegalStateException
- Raised when called twice on the sameRecordMessage
instance.
-
addLatencyChainPoint
Adds a latency chain point
- Parameters:
pointName
- The name associated with the latency measurement.instant
- The timestamp as a Java Instant. The time is of the same form as the value ofInstant.now()
.- Throws:
IllegalStateException
- Raised when the initial timestamp has not be initialised.
-