表示 Google Cloud Pub/Sub 訊息的介面。
簽名:
export declare class Message<T>
特性
財產 | 修飾符 | 類型 | 描述 |
---|---|---|---|
屬性 | { [鍵:字串]:字串; } | 隨訊息一起發布的使用者定義屬性(如果有)。 | |
數據 | 細繩 | 此訊息物件的資料負載為 Base64 編碼字串。 | |
json | 時間 | 此訊息物件的 JSON 資料負載(如果有)。 | |
訊息ID | 細繩 | 自動產生的 ID,唯一標識此訊息。 | |
訂購鍵 | 細繩 | 使用者定義的密鑰用於確保具有相同密鑰的訊息之間的排序。 | |
發佈時間 | 細繩 | 訊息發佈時間 |
方法
方法 | 修飾符 | 描述 |
---|---|---|
toJSON() | 傳回此物件的 JSON 可序列化表示形式。 |
pubsub.Message.attributes
隨訊息一起發布的使用者定義屬性(如果有)。
簽名:
readonly attributes: {
[key: string]: string;
};
pubsub.訊息.data
此訊息物件的資料負載為 Base64 編碼字串。
簽名:
readonly data: string;
pubsub.Message.json
此訊息物件的 JSON 資料負載(如果有)。
簽名:
get json(): T;
pubsub.Message.messageId
自動產生的 ID,唯一標識此訊息。
簽名:
readonly messageId: string;
pubsub.Message.orderingKey
使用者定義的密鑰用於確保具有相同密鑰的訊息之間的排序。
簽名:
readonly orderingKey: string;
pubsub.訊息.發佈時間
訊息發佈時間
簽名:
readonly publishTime: string;
pubsub.Message.toJSON()
傳回此物件的 JSON 可序列化表示形式。
簽名:
toJSON(): any;
返回:
任何
該物件的 JSON 可序列化表示。