Hola Everyone, I'm looking for the best strategy t...
# getting-started
a
Hola Everyone, I'm looking for the best strategy to host a Kotlin app on AppEngine and have the main method run once deployed, similar to how a Jars main method runs. In the applications's main method is logic to retrieve content from an API request based on a Timer and save that information to a database. Jars take a long time to deploy to AppEngine (10 - 20 min) which slows down development and is why I would like to move away from this approach. I've deployed using Ktor, but the main method doesn't appear to be initialized without an endpoint being called. Any insight is appreciated! 🙂
g
What AppEngine environment are you using, Flex or Standard?
a
@Gabriel Machado For Jars I'm using Flex, and when I've deployed with Ktor it's been in Standard per the GCP tutorial: https://cloud.google.com/community/tutorials/kotlin-ktor-app-engine-java8
g
In Standard, you might face problems with a Timer thread depending on the scaling you've chosen, see https://cloud.google.com/appengine/docs/standard/java/how-instances-are-managed
In this case I would rather use a cron.xml, https://cloud.google.com/appengine/docs/standard/java/config/cron
a
@Gabriel Machado - Thanks Gabriel! I'll research implementing a cron job within my Ktor app.