Show / Hide Table of Contents

Class Subscription

A named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application.

To get more information about Subscription, see:

  • API documentation
  • How-to Guides
  • Managing Subscriptions

Example Usage - Pubsub Subscription Different Project

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var exampleTopic = new Gcp.PubSub.Topic("exampleTopic", new Gcp.PubSub.TopicArgs
    {
        Project = "topic-project",
    });
    var exampleSubscription = new Gcp.PubSub.Subscription("exampleSubscription", new Gcp.PubSub.SubscriptionArgs
    {
        Project = "subscription-project",
        Topic = exampleTopic.Name,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Subscription
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.PubSub
Assembly: Pulumi.Gcp.dll
Syntax
public class Subscription : CustomResource

Constructors

View Source

Subscription(String, SubscriptionArgs, CustomResourceOptions)

Create a Subscription resource with the given unique name, arguments, and options.

Declaration
public Subscription(string name, SubscriptionArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

SubscriptionArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AckDeadlineSeconds

This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

Declaration
public Output<int> AckDeadlineSeconds { get; }
Property Value
Type Description
Output<System.Int32>
View Source

DeadLetterPolicy

A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscriptions's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.

Declaration
public Output<SubscriptionDeadLetterPolicy> DeadLetterPolicy { get; }
Property Value
Type Description
Output<SubscriptionDeadLetterPolicy>
View Source

ExpirationPolicy

A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.

Declaration
public Output<SubscriptionExpirationPolicy> ExpirationPolicy { get; }
Property Value
Type Description
Output<SubscriptionExpirationPolicy>
View Source

Labels

A set of key/value label pairs to assign to this Subscription.

Declaration
public Output<ImmutableDictionary<string, string>> Labels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>
View Source

MessageRetentionDuration

How long to retain unacknowledged messages in the subscription's backlog, from the moment a message is published. If retainAckedMessages is true, then this also configures the retention of acknowledged messages, and thus configures how far back in time a subscriptions.seek can be done. Defaults to 7 days. Cannot be more than 7 days (&quot;604800s&quot;) or less than 10 minutes (&quot;600s&quot;). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: &quot;600.5s&quot;.

Declaration
public Output<string> MessageRetentionDuration { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

Name of the subscription.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Path

Declaration
public Output<string> Path { get; }
Property Value
Type Description
Output<System.String>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

PushConfig

If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.

Declaration
public Output<SubscriptionPushConfig> PushConfig { get; }
Property Value
Type Description
Output<SubscriptionPushConfig>
View Source

RetainAckedMessages

Indicates whether to retain acknowledged messages. If true, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window.

Declaration
public Output<bool?> RetainAckedMessages { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Topic

A reference to a Topic resource.

Declaration
public Output<string> Topic { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, SubscriptionState, CustomResourceOptions)

Get an existing Subscription resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Subscription Get(string name, Input<string> id, SubscriptionState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

SubscriptionState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Subscription
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.