I need to have a TCP client that listens to messages constantly (and publish pub sub events for each message)
Since there is no Kafka in GCP, I'm trying to do it using my flask service (which runs using AppEngine in GCP).
I'm planning on setting the app.yaml
as:
manual_scaling:
instances: 1
But I can't figure out how to trigger code on the flask app startup.
I've tried running code in the main.py
and also tried to manipulate the main
function in it - but it obviously doesn't work as AppEngine doesn't run it.
Do you have any idea how can I init the listener on the Flask' app startup?
(Or any other offer regarding how should I implement a tcp client that sends pubsub events, or inserting to Big Query?)
CodePudding user response:
I eventually went for implementing a Kafka connector myself and using Kafka.