pubsub.Message class

Interface representing a Google Cloud Pub/Sub message.

Signature:

exportdeclareclassMessage

Constructors

ConstructorModifiersDescription
(constructor)(data)Constructs a new instance of theMessage class

Properties

PropertyModifiersTypeDescription
attributes{ [key: string]: string; }User-defined attributes published with the message, if any.
datastringThe data payload of this message object as a base64-encoded string.
jsonanyThe JSON data payload of this message object, if any.

Methods

MethodModifiersDescription
toJSON()Returns a JSON-serializable representation of this object.

pubsub.Message.(constructor)

Constructs a new instance of theMessage class

Signature:

constructor(data:any);

Parameters

ParameterTypeDescription
dataany

pubsub.Message.attributes

User-defined attributes published with the message, if any.

Signature:

readonlyattributes:{[key:string]:string;};

pubsub.Message.data

The data payload of this message object as a base64-encoded string.

Signature:

readonlydata:string;

pubsub.Message.json

The JSON data payload of this message object, if any.

Signature:

getjson():any;

pubsub.Message.toJSON()

Returns a JSON-serializable representation of this object.

Signature:

toJSON():any;

Returns:

any

A JSON-serializable representation of this object.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-09-13 UTC.