Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Subscription#setOptions() #12

Closed
stephenplusplus opened this issue Dec 13, 2017 · 3 comments
Closed

add Subscription#setOptions() #12

stephenplusplus opened this issue Dec 13, 2017 · 3 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. triaged for GA type: enhancement

Comments

@stephenplusplus
Copy link
Contributor

From @tonila on November 5, 2017 6:40

We are upgrading pubsub from 0.13.x to 0.14.x and current API documentation does not seem to answer our questions.

Documentation states that "subscription options do not persist across multiple instances".

With current knowledge, I assume it means, that subscription, that you see at cloud console does not store subscription options, so you need to set them for each instance you receive from the cloud.

But how do you set options, since subscription does not seem to have function for that?

Currently we are just always using topic.createSubscription() for new and existing subscriptions and it seems to work fine, but I am wondering, what is the intended way of doing this?

Copied from original issue: googleapis/google-cloud-node#2723

@stephenplusplus
Copy link
Contributor Author

You can set the options at the time of creating the Subscription reference object.

topic.createSubscription('name', { /* options */ })
// or...
var subscription = topic.subscription('name', { /* options */ })

You do bring up a good question-- how can you set the options when you get a Subscription from topic.getSubscriptions()? @callmehiphop ?

@stephenplusplus
Copy link
Contributor Author

From @callmehiphop on November 5, 2017 19:46

You currently can't, sounds like maybe we need to make a setter.

@stephenplusplus stephenplusplus changed the title pubsub: add Subscription#setOptions() add Subscription#setOptions() Dec 13, 2017
@stephenplusplus stephenplusplus added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Dec 13, 2017
@JustinBeckwith JustinBeckwith added the 🚨 This issue needs some love. label Jun 11, 2018
stephenplusplus pushed a commit to stephenplusplus/nodejs-pubsub that referenced this issue Aug 31, 2018
@callmehiphop callmehiphop self-assigned this Nov 12, 2018
@callmehiphop
Copy link
Contributor

We have a release coming up that will allow you to set options via setOptions method. We've also made some changes/additions to the available subscription options. Below is an example of using the setter with all the available options and their default values

subscription.setOptions({
  ackDeadline: 10,
  batching: {
    callOptions: {}, // gax call options
    maxMessages: 3000,
    maxMilliseconds: 100,
  },
  flowControl: {
    allowExcessMessages: true,
    maxBytes: os.freem() * 0.2,
    maxExtension: Infinity,
    maxMessages: 100
  },
  streamingOptions: {
    highWaterMark: 0,
    maxStreams: 5, // formerly known as maxConnections
    timeout: 60000 * 5, // 5 minutes
  }
});

@google-cloud-label-sync google-cloud-label-sync bot added the api: pubsub Issues related to the googleapis/nodejs-pubsub API. label Jan 31, 2020
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. triaged for GA type: enhancement
Projects
None yet
Development

No branches or pull requests

5 participants