表示 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 可序列化表示。