Reference documentation and code samples for the Cloud Scheduler V1 Client class PubsubTarget.
Pub/Sub target. The job will be delivered by publishing a message to
the given Pub/Sub topic.
Generated from protobuf message google.cloud.scheduler.v1.PubsubTarget
Namespace
Google \ Cloud \ Scheduler \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ topic_name
string
Required. The name of the Cloud Pub/Sub topic to which messages will be published when a job is delivered. The topic name must be in the same format as required by Pub/Sub's PublishRequest.name, for example projects/PROJECT_ID/topics/TOPIC_ID. The topic must be in the same project as the Cloud Scheduler job.
↳ data
string
The message payload for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute.
Attributes for PubsubMessage. Pubsub message must contain either non-empty data, or at least one attribute.
getTopicName
Required. The name of the Cloud Pub/Sub topic to which messages will
be published when a job is delivered. The topic name must be in the
same format as required by Pub/Sub's
PublishRequest.name,
for example projects/PROJECT_ID/topics/TOPIC_ID.
The topic must be in the same project as the Cloud Scheduler job.
Returns
Type
Description
string
setTopicName
Required. The name of the Cloud Pub/Sub topic to which messages will
be published when a job is delivered. The topic name must be in the
same format as required by Pub/Sub's
PublishRequest.name,
for example projects/PROJECT_ID/topics/TOPIC_ID.
The topic must be in the same project as the Cloud Scheduler job.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getData
The message payload for PubsubMessage.
Pubsub message must contain either non-empty data, or at least one
attribute.
Returns
Type
Description
string
setData
The message payload for PubsubMessage.
Pubsub message must contain either non-empty data, or at least one
attribute.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getAttributes
Attributes for PubsubMessage.
Pubsub message must contain either non-empty data, or at least one
attribute.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Scheduler V1 Client - Class PubsubTarget (2.0.5)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.5 (latest)](/php/docs/reference/cloud-scheduler/latest/V1.PubsubTarget)\n- [2.0.4](/php/docs/reference/cloud-scheduler/2.0.4/V1.PubsubTarget)\n- [1.10.5](/php/docs/reference/cloud-scheduler/1.10.5/V1.PubsubTarget)\n- [1.9.4](/php/docs/reference/cloud-scheduler/1.9.4/V1.PubsubTarget)\n- [1.8.3](/php/docs/reference/cloud-scheduler/1.8.3/V1.PubsubTarget)\n- [1.7.1](/php/docs/reference/cloud-scheduler/1.7.1/V1.PubsubTarget)\n- [1.6.8](/php/docs/reference/cloud-scheduler/1.6.8/V1.PubsubTarget) \nReference documentation and code samples for the Cloud Scheduler V1 Client class PubsubTarget.\n\nPub/Sub target. The job will be delivered by publishing a message to\nthe given Pub/Sub topic.\n\nGenerated from protobuf message `google.cloud.scheduler.v1.PubsubTarget`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Scheduler \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getTopicName\n\nRequired. The name of the Cloud Pub/Sub topic to which messages will\nbe published when a job is delivered. The topic name must be in the\nsame format as required by Pub/Sub's\n[PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest),\nfor example `projects/PROJECT_ID/topics/TOPIC_ID`.\n\nThe topic must be in the same project as the Cloud Scheduler job.\n\n### setTopicName\n\nRequired. The name of the Cloud Pub/Sub topic to which messages will\nbe published when a job is delivered. The topic name must be in the\nsame format as required by Pub/Sub's\n[PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest),\nfor example `projects/PROJECT_ID/topics/TOPIC_ID`.\n\nThe topic must be in the same project as the Cloud Scheduler job.\n\n### getData\n\nThe message payload for PubsubMessage.\n\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n### setData\n\nThe message payload for PubsubMessage.\n\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n### getAttributes\n\nAttributes for PubsubMessage.\n\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n### setAttributes\n\nAttributes for PubsubMessage.\n\nPubsub message must contain either non-empty data, or at least one\nattribute."]]