minos.saga.messages

Classes

SagaRequest

Saga Request class.

SagaResponse

Saga Response class.

SagaResponseStatus

Saga Response Status class.

class SagaRequest[source]

Bases: object

Saga Request class.

__init__(target, content=None)[source]
Parameters
property target: str

Get the target of the request.

Returns

A str instance.

async content(**kwargs)[source]

Get the content of the request.

Parameters

kwargs – Additional named parameters.

Returns

The content of the request.

Return type

Any

class SagaResponse[source]

Bases: object

Saga Response class.

__init__(content=None, related_services=None, status=None, uuid=None, *args, **kwargs)[source]
Parameters
classmethod from_message(message)[source]

Build a new SagaResponse from a BrokerMessage.

Parameters

message (BrokerMessage) – The BrokerMessage instance.

Returns

A SagaResponse.

Return type

SagaResponse

async content(**kwargs)[source]

Get the response content.

Parameters

kwargs – Additional named parameters.

Returns

The content of the response.

Return type

Any

property ok: bool

Check if the response is okay.

Returns

True if the response is okay

property status: minos.saga.messages.SagaResponseStatus

Get the status code of the response.

Returns

A ResponseStatus instance.

property related_services: set[str]

Get the microservice name that generated the response.

Returns

An string value containing the microservice name.

property uuid: uuid.UUID

Get the identifier of the saga execution that must receive the response.

Returns

An UUID value.

class SagaResponseStatus[source]

Bases: IntEnum

Saga Response Status class.

SUCCESS = 200
ERROR = 400
SYSTEM_ERROR = 500
classmethod from_raw(raw)[source]

Build a new instance from raw.

Parameters

raw (int) – The raw representation of the instance.

Returns

A SagaResponseStatus instance.

Return type

SagaResponseStatus