0

Does Cloud Pub/Sub support publishing test messages, i.e. messages that are truly published but not forwarded to the subscribers, to verify the integration between your application and the remote Cloud Pub/Sub?

I could imagine doing this manually by setting a test attribute flag for such messages so that subscribers can filter them out. I know that there also exists the Cloud Pub/Sub emulator for local testing but I was wondering if there exists such a feature?

Andi
  • 8,154
  • 3
  • 30
  • 34

1 Answers1

2

No. This feature doesn't exists. However, your subscriber should be tolerant to error and not compliant messages.

I suggest to publish a wrong message. Your integration is tested, and the subscriber behavior and fault tolerance also. Bonus, you can filter log Trace of your subscribers in the stackdriver logging service and create an alert in case of wrong message received, in real production environment

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • Can you tell me on production env what should be my considering look like to deal the excepted scenarios for subscribers. – Indrajeet Gour Dec 10 '19 at 11:42
  • All depends of your requirements. However a simple example. Imagine that your message required 3 attributes. In case of wrong attribute, you print the message content and attribute in logs. All the errors will be printed in your logs and you can easily plug metrics and alert on it. If you want to perform a test message which create an error, define a convention: name an attribute `test` with value `test`. In your metrics and alert part, customize your log filter to exclude these tests messages. And thus you won't be alerted for test, but test message is logged. Is it answer your question? – guillaume blaquiere Dec 10 '19 at 12:21