{"action":"opened","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/401","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/401/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/401/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/issues/401/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-ruby/issues/401","id":113456737,"number":401,"title":"Pub/Sub Topic auto-create is confusing","user":{"login":"blowmage","id":730,"avatar_url":"https://avatars.githubusercontent.com/u/730?v=3","gravatar_id":"","url":"https://api.github.com/users/blowmage","html_url":"https://github.com/blowmage","followers_url":"https://api.github.com/users/blowmage/followers","following_url":"https://api.github.com/users/blowmage/following{/other_user}","gists_url":"https://api.github.com/users/blowmage/gists{/gist_id}","starred_url":"https://api.github.com/users/blowmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blowmage/subscriptions","organizations_url":"https://api.github.com/users/blowmage/orgs","repos_url":"https://api.github.com/users/blowmage/repos","events_url":"https://api.github.com/users/blowmage/events{/privacy}","received_events_url":"https://api.github.com/users/blowmage/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-ruby/labels/pubsub","name":"pubsub","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-26T21:38:10Z","updated_at":"2015-10-26T21:38:10Z","closed_at":null,"body":"One of the issues with the current Pub/Sub design is the behavior of auto-creating topic objects. Currently, it is possible for the topic to create itself while publishing:\r\n\r\n```ruby\r\ntopic = gcloud.pubsub.topic(\"not-yet-created\")\r\ntopic.publish \"Some message\" # Topic is created in this call\r\n```\r\n\r\nA more verbose version of the same code is:\r\n\r\n```ruby\r\ntopic = gcloud.pubsub.topic(\"not-yet-created\", autocreate: true)\r\ntopic.publish \"Some message\" # Topic is created in this call\r\n```\r\n\r\nHaving the creation occur on `Topic#publish` instead of `Project#topic` is confusing. Along with the proposed `Project#publish` in #400, we also propose streamlining the auto-create functionality by making the following changes:\r\n\r\n* Set the default behavior for `autocreate` to `false`. The current default value is `true`.\r\n* Create the record on the method that the `autocreate` option is specified on:\r\n\r\n```ruby\r\ntopic = gcloud.pubsub.topic(\"not-yet-created\", autocreate: true) # Topic is created in this call\r\ntopic.publish \"Some message\" # Message is published in this call\r\n```\r\n\r\nThis will change performance, but `Project#publish` as defined in #400 will maintain existing performance. But the behavior is more inline with where we believe more developers expectations are."}}