entrypoints module

class micro_framework.entrypoints.Entrypoint

Bases: micro_framework.extensions.Extension

async bind(runner, parent=None)

Binds the extension to the service runner and parent. :param Runner runner: Service Runner

async call_route(entry_id, *args, _meta=None, **kwargs)

Call the binded Route to start a new worker with the received content from the entrypoint.

It returns the Instantiated Worker.

This method caller should handle the following exceptions:

. PoolStopped: Raises when the worker is signalled to stop. . Exception: Some internal error during the call to the worker.

Parameters

entry_id – Some object/identifier to be used to send a response

for the correct caller.

Parameters

args – Additional arguments to be sent to the Route target

function (such as payload for the event case)

Parameters

_meta – Metadata about this entrypoint, usually for internal

use. (See AsyncRetry to an example)

Parameters

kwargs – Additional kwargs to be sent to the Route target

function.

route = None
class micro_framework.entrypoints.TimeEntrypoint(interval)

Bases: micro_framework.entrypoints.Entrypoint

async start()

Start a loop that sleeps for a configured interval and then call the bind Route.

Since it runs in a loop, some caution should be taken to prevent it from locking the event loop.

async stop()

Commands the extension to do a graceful stop