I am working on a Nodejs project which publish and subscribe data to Google Cloud Platform PubSub. Currently, I am subscribing to Google Cloud Platform PubSub by providing subscription name. But to improve performance I was recommended to find out a way we can subscribe to PubSub Topic with topic name instead of a subscription name. So, is there a way we can do that ?
You won't speed up anything by listening a topic! At the opposite, you will slow down your startup time!!
Indeed, you can't receive messages from Pubsub without a subscription. If you subscribe directly to a topic, a new subscription is created and then you start to listen the message.
if you listen directly a subscription, you don't have to create it, and you start quicker to listen the messages.
The real question that you need to have is: what is your requirement?