@Optional public interface ExtensionHeader
The ExtensionHeader
interface contains extended properties for common implementations in current messaging
and streaming field, such as the queue-based partitioning implementation, but the related properties in this
interface are not mandatory.
Modifier and Type | Method and Description |
---|---|
String |
getCorrelationId()
|
long |
getDelayTime()
|
long |
getExpireTime()
|
String |
getMessageKey()
|
long |
getOffset()
This method will return the
OFFSET in the partition to which the message belongs to, but the premise is
that the implementation of the server side is dependent on the partition or a queue-like storage mechanism. |
int |
getPartiton()
This method will return the partition of this message belongs.
|
String |
getStoreHost()
|
long |
getStoreTimestamp()
|
String |
getTraceId()
|
String |
getTransactionId()
|
ExtensionHeader |
setCorrelationId(String correlationId)
A client can use the
CORRELATION_ID field to link one message with another. |
ExtensionHeader |
setDelayTime(long delayTime)
The
DELAY_TIME header field contains a number that represents the delayed times in milliseconds. |
ExtensionHeader |
setExpireTime(long expireTime)
The
EXPIRE_TIME header field contains the expiration time, it represents a time-to-live value. |
ExtensionHeader |
setMessageKey(String messageKey)
The
messagekey header field contains the custom key of a message. |
ExtensionHeader |
setOffset(long offset)
This method is only called by the server.
|
ExtensionHeader |
setPartition(int partition)
The
PARTITION in extension header field contains the partition of target destination which the message
is being sent. |
ExtensionHeader |
setStoreHost(String storeHost)
The
STORE_HOST header field contains the store host info of a message in server side. |
ExtensionHeader |
setStoreTimestamp(long storeTimestamp)
The
STORE_TIMESTAMP header field contains the store timestamp of a message in server side. |
ExtensionHeader |
setTraceId(String traceId)
The
TRACE_ID header field contains the trace ID of a message, which represents a global and unique
identification, to associate key events in the whole lifecycle of a message, like sent by who, stored at where,
and received by who. |
ExtensionHeader |
setTransactionId(String transactionId)
This field
TRANSACTION_ID is used in transactional message, and it can be used to trace a transaction. |
ExtensionHeader setPartition(int partition)
PARTITION
in extension header field contains the partition of target destination which the message
is being sent.
When a Message
is set with this value, this message will be delivered to specified partition, but the
premise is that the implementation of the server side is dependent on the partition or a queue-like storage
mechanism.
partition
- The specified partition will be sent to.ExtensionHeader setOffset(long offset)
OFFSET
represents this message offset in partition.
offset
- The offset in the current partition, used to quickly get this message in the queueExtensionHeader setCorrelationId(String correlationId)
CORRELATION_ID
field to link one message with another. A typical use is to link a
response message with its request message.ExtensionHeader setTransactionId(String transactionId)
TRANSACTION_ID
is used in transactional message, and it can be used to trace a transaction.
So the same TRANSACTION_ID
will be appeared not only in prepare message, but also in commit message, and
consumer received message also contains this field.ExtensionHeader setStoreTimestamp(long storeTimestamp)
STORE_TIMESTAMP
header field contains the store timestamp of a message in server side.
When a message is sent, STORE_TIMESTAMP is ignored.
When the send method returns it contains a server-assigned value.
This filed is a long
value, measured in milliseconds.
ExtensionHeader setStoreHost(String storeHost)
STORE_HOST
header field contains the store host info of a message in server side.
When a message is sent, STORE_HOST is ignored.
When the send method returns it contains a server-assigned value.
ExtensionHeader setMessageKey(String messageKey)
messagekey
header field contains the custom key of a message.
This key is a customer identifier for a class of messages, and this key may be used for server to hash or dispatch messages, or even can use this key to implement order message.
ExtensionHeader setTraceId(String traceId)
TRACE_ID
header field contains the trace ID of a message, which represents a global and unique
identification, to associate key events in the whole lifecycle of a message, like sent by who, stored at where,
and received by who.
And, the messaging system only plays exchange role in a distributed system in most cases, so the TraceID can be
used to trace the whole call link with other parts in the whole system.ExtensionHeader setDelayTime(long delayTime)
DELAY_TIME
header field contains a number that represents the delayed times in milliseconds.
The message will be delivered after delayTime milliseconds starting from BORN_TIMESTAMP
. When this filed
isn't set explicitly, this means this message should be delivered immediately.ExtensionHeader setExpireTime(long expireTime)
EXPIRE_TIME
header field contains the expiration time, it represents a time-to-live value.
The EXPIRE_TIME
represents a relative valid interval that a message can be delivered in it. If the
EXPIRE_TIME field is specified as zero, that indicates the message does not expire.
When an undelivered message's expiration time is reached, the message should be destroyed. OMS does not define a notification of message expiration.
int getPartiton()
PARTITION
to which the message belongslong getOffset()
OFFSET
in the partition to which the message belongs to, but the premise is
that the implementation of the server side is dependent on the partition or a queue-like storage mechanism.String getCorrelationId()
String getTransactionId()
long getStoreTimestamp()
String getStoreHost()
long getDelayTime()
long getExpireTime()
String getMessageKey()
String getTraceId()
Copyright © 2017–2020 OpenMessaging. All rights reserved.