googlearchive / cloud-functions-emulator

A local emulator for deploying, running, and debugging Google Cloud Functions.
https://github.com/GoogleCloudPlatform/cloud-functions-emulator/wiki
Apache License 2.0
827 stars 115 forks source link

Trigger background functions using the pubsub emulator #28

Open agonbina opened 7 years ago

agonbina commented 7 years ago

Note: this is a feature request

Description

It would be great to have functions that are subscribed to pubsub topics trigger when a new message is published in this topic, locally, in the pubsub emulator.

On startup, the emulator could check if there is a PUBSUB_EMULATOR_HOST env variable set, which would signal that the pubsub emulator is running. The @google-cloud/pubsub node sdk is aware of this env variable and is able to talk to the emulator instead of a production pubsub service.

The emulator can then subscribe to the topics each background function is bound to and trigger them on every message respectively.

Do you think this is something that could be supported in the future? Thanks!

jmdobry commented 7 years ago

This sounds like a great feature! I think we can do it.

MrWako commented 7 years ago

Just adding support for this - it would be awesome and just what I'm looking for. Thanks.

oliversturm commented 7 years ago

Any news on this? I just spent quite some time wondering why my function wasn't being triggered after using functions deploy .... --trigger-topic ... to set it up. Never crossed my mind that the two emulators would not work together!

o1lab commented 6 years ago

..bump

valendesigns commented 6 years ago

Any updates on this issue? I'm glad I found it because I thought my code wasn't working. I suspected it might be the emulator, but couldn't find any docs that described the issue.

knitterb commented 6 years ago

This would be awesome for developing a pipeline and seeing it work during integration testing.