I'm my pipeline (Java) I have set the option of read from pubsub using the subscription or the topic:
PCollection<PubsubMessage> messages = null;
if (options.getUseSubscription()) {
messages = pipeline.apply("ReadPubSubSubscription", PubsubIO.readMessagesWithAttributes()
.fromSubscription(options.getInputSubscription()).withIdAttribute("messageId"));
} else {
messages = pipeline.apply("ReadPubSubTopic", PubsubIO.readMessagesWithAttributes()
.fromTopic(options.getInputTopic()).withIdAttribute("messageId"));
}
If you use the topic option, each time you run your pipeline, a new subscription is created.
Is there any way of avoiding that? Maybe set the name of the subscription that is created automatically from Dataflow?