-
Notifications
You must be signed in to change notification settings - Fork 653
Closed
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.
Description
Environment details
- OS: macOS Sierra version 10.12.2
- Node.js version: v8.2.1
- npm version: 4.6.1
- google-cloud-node version: 0.14.2
Steps to reproduce
- require
google-cloud - initialize pubsubClient
- create subscription to a topic with config option
retainAckedMessagesset to true (see code below) - push 5 messages to a topic
- pull and acknowledge the 5 messages from the topic successfully the first time
- in a second attempt to pull the 5 messages again, 0 are retrieved
- get the metadata for the subscription created to the topic in step 3, and
retainAckedMessagesis set to false (andmessageRetentionDurationis set to null even though it should default to 7 days)
Below is the code I use to create a subscription
const PubSub = require('@google-cloud/pubsub');
const Keys = require('./json/pubsub-editor-keys');
const projectId = 'my-project-id';
let pubsubClient;
const subscriptionName = 'my-subscription-name';
const topicName = 'my-topic';
const initializePubSubClient = (client_email, private_key) => {
const options = {
projectId,
credentials: {
client_email,
private_key
}
};
pubsubClient = PubSub(options);
}
const createSubscription = (topic, name) => {
const options = {
retainAckedMessages: true
};
console.log('createSubscription called');
pubsubClient
.createSubscription(topic, name, options)
.then((data) => {
const subscription = data[0];
const apiResponse = data[1];
console.log('subscription', subscription);
console.log('apiResponse', apiResponse);
})
.catch((err) => {
console.log('error', err);
});
}
initializePubSubClient(Keys.client_email, Keys.private_key);
createSubscription(topicName, subscriptionName);- I would like to create a pull subscription to a topic where acknowledged messages are retained for a set amount of time.
- I have tried accomplishing this by setting retainAckedMessages to true and leaving messageRetentionDuration as the default 7 days; however, I have not had success in initializing a subscription with those option values.
- Regardless of the options I use to initialize the subscription, acknowledged messages are removed from the subscribed topic's stored messages.
- Related to pubsub: implement message retention #2240
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.