minos.saga.definitions.saga module¶
- class minos.saga.definitions.saga.Saga(*args, steps=None, committed=False, commit=None, **kwargs)[source]¶
Bases:
objectSaga class.
The purpose of this class is to define a sequence of operations among microservices.
- commit(callback=None, **kwargs)[source]¶
Commit the instance to be ready for execution.
- Parameters
callback (
None) – Deprecated argument.kwargs – Additional named arguments.
- Return type
- Returns
A
Sagainstance.
- conditional_step(step=None)[source]¶
Add a new conditional step.
- Parameters
step (
typing.Optional[minos.saga.definitions.steps.conditional.ConditionalSagaStep]) – The step to be added. If None is provided then a new one will be created.- Return type
minos.saga.definitions.steps.conditional.ConditionalSagaStep- Returns
A
SagaStepinstance.
- classmethod from_raw(raw, **kwargs)[source]¶
Build a new
Sagainstance from raw.- Parameters
raw (
typing.Union[dict[str,typing.Any],minos.saga.definitions.saga.Saga]) – The raw representation of the saga.kwargs – Additional named arguments.
- Return type
- Returns
A new
Sagainstance.
- local_step(step=None, **kwargs)[source]¶
Add a new local step.
- Parameters
step (
typing.Union[collections.abc.Callable[minos.saga.context.SagaContext, …,typing.Union[minos.saga.context.SagaContext,None,typing.Awaitable[typing.Optional[minos.saga.context.SagaContext]]]],minos.saga.definitions.operations.SagaOperation[collections.abc.Callable[minos.saga.context.SagaContext, …,typing.Union[minos.saga.context.SagaContext,None,typing.Awaitable[typing.Optional[minos.saga.context.SagaContext]]]]],minos.saga.definitions.steps.local.LocalSagaStep,None]) – The step to be added. If None is provided then a new one will be created.kwargs – Additional named parameters.
- Return type
- Returns
A
SagaStepinstance.
- property raw: dict[str, typing.Any]¶
Generate a raw representation of the instance.
- Return type
dict[str,typing.Any]- Returns
A
dictinstance.
- remote_step(step=None, **kwargs)[source]¶
Add a new remote step step.
- Parameters
step (
typing.Union[collections.abc.Callable[minos.saga.context.SagaContext, …,typing.Union[minos.saga.messages.SagaRequest,typing.Awaitable[minos.saga.messages.SagaRequest]]],minos.saga.definitions.operations.SagaOperation[collections.abc.Callable[minos.saga.context.SagaContext, …,typing.Union[minos.saga.messages.SagaRequest,typing.Awaitable[minos.saga.messages.SagaRequest]]]],minos.saga.definitions.steps.remote.RemoteSagaStep,None]) – The step to be added. If None is provided then a new one will be created.kwargs – Additional named parameters.
- Return type
- Returns
A
SagaStepinstance.
- step(step=None, **kwargs)[source]¶
Add a new remote step step.
- Parameters
step (
typing.Union[collections.abc.Callable[minos.saga.context.SagaContext, …,typing.Union[minos.saga.messages.SagaRequest,typing.Awaitable[minos.saga.messages.SagaRequest]]],minos.saga.definitions.operations.SagaOperation[collections.abc.Callable[minos.saga.context.SagaContext, …,typing.Union[minos.saga.messages.SagaRequest,typing.Awaitable[minos.saga.messages.SagaRequest]]]],minos.saga.definitions.steps.remote.RemoteSagaStep,None]) – The step to be added. If None is provided then a new one will be created.kwargs – Additional named parameters.
- Return type
- Returns
A
SagaStepinstance.