Search code examples
google-cloud-platformgoogle-cloud-functionsgoogle-cloud-pubsubgoogle-cloud-scheduler

Is it possible for google cloud scheduler to push a list of data to pub/sub at a given frequency?


I would like a cloud function to be triggered by pub/sub at a given frequency (1 second).

Setting a scheduler like below can achieve this, but the payload that get sent to the pub/sub is always the same, so the cloud function triggered will always receive same input.

Is it possible to pass a list of data as payload, and push the elements of that list to pub/sub one by one at the frequency 1/sec? So the interval between cloud function being triggered is one second?

enter image description here


Solution

  • Is it possible to pass a list of data as payload

    You can put whatever you want in that payload. If you want a list, perhaps you could encode it as a JSON list or something similar that's easy to parse.

    and push the elements of that list to pub/sub one by one at the frequency 1/sec? So the interval between cloud function being triggered is one second?

    That's too frequent. The best you can do is get a rate of once every minute, according the specs in the documentation.