From da3bb70ff88fd0c76f5c9e589c4b13be183b3c26 Mon Sep 17 00:00:00 2001 From: zhoubo0404 <877036922@qq.com> Date: Mon, 3 Jun 2019 19:33:02 +0800 Subject: [PATCH] [ISSUES 55] MessageReceipt should have getMessageId and getOffset API (https://github.com/openmessaging/openmessaging-java/issues/55) --- .../consumer/MessageReceipt.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/openmessaging-api/src/main/java/io/openmessaging/consumer/MessageReceipt.java b/openmessaging-api/src/main/java/io/openmessaging/consumer/MessageReceipt.java index 26a75395..2c8c9ff3 100644 --- a/openmessaging-api/src/main/java/io/openmessaging/consumer/MessageReceipt.java +++ b/openmessaging-api/src/main/java/io/openmessaging/consumer/MessageReceipt.java @@ -17,6 +17,8 @@ package io.openmessaging.consumer; +import io.openmessaging.message.Header; + /** * A {@code MessageReceipt} is a {@code Message} with a {@code Receipt}. * @@ -24,4 +26,32 @@ * @since OMS 1.0.0 */ public interface MessageReceipt { + /** + * {@code OFFSET} represents this message offset in partition. + *

+ * + * @param offset The offset in the current partition, used to quickly get this message in the queue + */ + void setOffset(long offset); + + /** + * This method will return the {@code 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. + * + * @return The offset of the partition to which the message belongs. + */ + long getOffset(); + + /** + * The {@code MESSAGE_ID} header field contains a value that uniquely identify each message sent by a {@code + * Producer}. this identifier is generated by producer. + */ + void setMessageId(String messageId); + + /** + * See {@link Header#setMessageId(String)} + * + * @return messageId + */ + String getMessageId(); }