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.
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.
[[["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-08-07 UTC."],[],[],null,["# Interface PubsubTargetOrBuilder (0.16.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.16.0 (latest)](/java/docs/reference/google-cloudevent-types/latest/com.google.events.cloud.scheduler.v1.PubsubTargetOrBuilder)\n- [0.15.0](/java/docs/reference/google-cloudevent-types/0.15.0/com.google.events.cloud.scheduler.v1.PubsubTargetOrBuilder)\n- [0.14.1](/java/docs/reference/google-cloudevent-types/0.14.1/com.google.events.cloud.scheduler.v1.PubsubTargetOrBuilder) \n\n public interface PubsubTargetOrBuilder extends MessageOrBuilder\n\nImplements\n----------\n\n[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)\n\nMethods\n-------\n\n### containsAttributes(String key)\n\n public abstract boolean containsAttributes(String key)\n\nAttributes for PubsubMessage.\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n`map\u003cstring, string\u003e attributes = 4;`\n\n### getAttributes()\n\n public abstract Map\u003cString,String\u003e getAttributes()\n\nUse [#getAttributesMap()](/java/docs/reference/google-cloudevent-types/latest/com.google.events.cloud.scheduler.v1.PubsubTargetOrBuilder#com_google_events_cloud_scheduler_v1_PubsubTargetOrBuilder_getAttributesMap__) instead.\n\n### getAttributesCount()\n\n public abstract int getAttributesCount()\n\nAttributes for PubsubMessage.\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n`map\u003cstring, string\u003e attributes = 4;`\n\n### getAttributesMap()\n\n public abstract Map\u003cString,String\u003e getAttributesMap()\n\nAttributes for PubsubMessage.\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n`map\u003cstring, string\u003e attributes = 4;`\n\n### getAttributesOrDefault(String key, String defaultValue)\n\n public abstract String getAttributesOrDefault(String key, String defaultValue)\n\nAttributes for PubsubMessage.\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n`map\u003cstring, string\u003e attributes = 4;`\n\n### getAttributesOrThrow(String key)\n\n public abstract String getAttributesOrThrow(String key)\n\nAttributes for PubsubMessage.\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n`map\u003cstring, string\u003e attributes = 4;`\n\n### getData()\n\n public abstract ByteString getData()\n\nThe message payload for PubsubMessage.\nPubsub message must contain either non-empty data, or at least one\nattribute.\n\n`bytes data = 3;`\n\n### getTopicName()\n\n public abstract String 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`.\nThe topic must be in the same project as the Cloud Scheduler job.\n\n`string topic_name = 1;`\n\n### getTopicNameBytes()\n\n public abstract ByteString getTopicNameBytes()\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`.\nThe topic must be in the same project as the Cloud Scheduler job.\n\n`string topic_name = 1;`"]]