how create a python service, executed when needed

Question:

I want to create a notification service, that will be used in diferent applications. But I would run it only sometimes. How I achieve this? I will try to use webhooks, informing my service to notify something

basically, I don’t keep my service running. I would deploy this in heroku, and heroku sleeps my app when it doen’st receive any request, but I think there is a methodology (I mean, a type of application that runs when needed) about this.

So, I would create webhooks in my main app that inform my service when notify, and I want to run the service only when this communication occurs.
By the way, I never use webhooks, so maybe I misleading something

Asked By: vitxr

||

Answers:

What you are describing is a Serverless Architecture.

Serverless is a computing model in which a cloud provider allocates and manages the resources needed to run an application or function, and only charges for the actual execution of that application or function. Serverless architectures are often used for running microservices and executing functions in response to events or triggers.

Heroku presently does not have a serverless offering. Therefore you will need to rely on another cloud provider.

With regards to the trigger mechanism of the serverless function, webhooks sound like a good approach. You can roll out your own webhook infrastructure or use a webhook as a service offering like the one I’ve built to deliver and manage the webhooks.

Note: Just for posterity’s sake I will mention that there are some "custom implementations" of serverless functions using Heroku’s one-off dynos, but I would advise against using such solutions unless you absolutely must use Heroku. This is because if Heroku changes something in its execution model it may pose a risk to your service and break it in ways that are not expected.

Answered By: dxtime
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.