minos.saga.definitions.saga

Classes

Saga

Saga class.

class Saga[source]

Bases: object

Saga class.

The purpose of this class is to define a sequence of operations among microservices.

__init__(*args, steps=None, committed=False, commit=None, **kwargs)[source]
Parameters
classmethod from_raw(raw, **kwargs)[source]

Build a new Saga instance from raw.

Parameters
  • raw (Union[dict[str, Any], Saga]) – The raw representation of the saga.

  • kwargs – Additional named arguments.

Returns

A new Saga instance.

Return type

Saga

conditional_step(step=None)[source]

Add a new conditional step.

Parameters

step (Optional[ConditionalSagaStep]) – The step to be added. If None is provided then a new one will be created.

Returns

A SagaStep instance.

Return type

ConditionalSagaStep

local_step(step=None, **kwargs)[source]

Add a new local step.

Parameters
Returns

A SagaStep instance.

Return type

LocalSagaStep

step(step=None, **kwargs)[source]

Add a new remote step step.

Parameters
Returns

A SagaStep instance.

Return type

RemoteSagaStep

remote_step(step=None, **kwargs)[source]

Add a new remote step step.

Parameters
Returns

A SagaStep instance.

Return type

RemoteSagaStep

property raw: dict[str, Any]

Generate a raw representation of the instance.

Returns

A dict instance.

commit(callback=None, **kwargs)[source]

Commit the instance to be ready for execution.

Parameters
  • callback (None) – Deprecated argument.

  • kwargs – Additional named arguments.

Returns

A Saga instance.

Return type

Saga

validate()[source]

Check if the saga is valid.

Returns

This method does not return anything, but raises an exception if the saga is not valid.

Return type

None