Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Google Cloud Pub/Sub Sample

This C# sample demonstrates how to call the Google Cloud Pub/Sub API from C#.

This sample requires .NET Core 2.0 or later. That means using Visual Studio 2017, or the command line. Visual Studio 2015 users can use this older sample.

Build and Run

  1. Follow the instructions in the root README.

  2. Enable APIs for your project. Click here to visit Cloud Platform Console and enable the Google Stackdriver Cloud Pub/Sub API.

  3. Edit QuickStart.cs, and replace YOUR-PROJECT-ID with the id of the project you created in step 1.

  4. From a Powershell command line, run the QuickStart sample:

    PS C:\...\dotnet-docs-samples\pubsub\api\QuickStart> dotnet restore
    PS C:\...\dotnet-docs-samples\pubsub\api\QuickStart> dotnet run
    Topic projects/YOUR-PROJECT-ID/topics/my-new-topic created.
    
  5. And run the Pubsub sample to see a list of subcommands like createTopic and createSubscription:

    PS C:\...\dotnet-docs-samples\pubsub\api\PubsubSample> dotnet restore
    PS C:\...\dotnet-docs-samples\pubsub\api\PubsubSample> dotnet run
    Pubsub 1.0.0.0
    Copyright c Google Inc. 2017
    
    ERROR(S):
      No verb selected.
    
      createTopic                 Create a pubsub topic in this project.
    
      createSubscription          Create a pubsub subscription in this project.
    
      createTopicMessage          Create a pubsub topic message in this project.
    
      pullTopicMessages           Pull pubsub messages in this project.
    
      getTopic                    Get the details of a pubsub topic in this project.
    
      getSubscription             Get the details of a pubsub subscription in this project.
    
      getTopicIamPolicy           Get the IAM policy of a topic in this project.
    
      getSubscriptionIamPolicy    Get the IAM policy of a subscription in this project.
    
      setTopicIamPolicy           Set the IAM policy of a topic in this project.
    
      setSubscriptionIamPolicy    Set the IAM policy of a subscription in this project.
    
      listProjectTopics           List the pubsub topics in this project.
    
      listSubscriptions           List the pubsub subscriptions in this project.
    
      deleteSubscription          Delete a pubsub subscription in this project.
    
      deleteTopic                 Delete a pubsub topic in this project.
    
      help                        Display more information on a specific command.
    
      version                     Display version information.
    

Contributing changes

Licensing

Testing