Hello,
Looks like in pubsub-0.14.0 the Subscription.pull() function was deprecated.
What replaces it in case I want to get all pending messages in a subscription?
Thanks
@LeonLiber now the only to receive messages is through event emitter events. This change was made at the request of the PubSub team.
subscription
.on('error', err => console.error(err))
.on('message', message => message.ack());
@LeonLiber it is possible however to access the pull rpc via gapic layer. I believe the following would work
const options = {
keyFile: '/path/to/keyfile',
projectId: 'my-project',
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/pubsub'
]
};
const pubsub = require('@google-cloud/pubsub').v1(options);
const subscriber = new pubsub.Subscriber(options);
subscriber.pull({
subscription: 'projects/grape-spaceship-123/subscriptions/my-sub',
maxMessages: 10
}, err => {});
Thank you very much, I'll give it a shot :)
this is really confusing, the docs still show pull (https://googlecloudplatform.github.io/google-cloud-node/#/docs/google-cloud/0.56.0/pubsub/subscription?method=pull).
why was this removed? seems like a reasonable api to have, it exists in other client libraries (c# for instance) why not here?
Those are older metadata package docs. More recent docs will show that pull is no longer available - https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.5/pubsub/subscription.
why was this removed?
It was removed at the request of the PubSub team, however we've seen a number of users requesting it, so maybe we should re-implement it? WDYT @lukesneeringer?
@callmehiphop or @lukesneeringer do you have any idea about if, and if yes, when we an expect the return of the pull method?
@thvd I would just assume it's not coming back, the PubSub team was very specific about deprecating it.