ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
provision_parties_workflow Class Reference

Saga executor for the provision_parties workflow. More...

#include <provision_parties_workflow.hpp>

Inheritance diagram for provision_parties_workflow:
Inheritance graph
Collaboration diagram for provision_parties_workflow:
Collaboration graph

Public Member Functions

 provision_parties_workflow (boost::uuids::uuid workflow_id, messaging::provision_parties_request request, std::string correlation_id)
 Constructs the executor.
 
bool execute (ores::database::context ctx, ores::nats::service::nats_client &nats) override
 Execute all saga steps in order.
 
void compensate (ores::database::context ctx, ores::nats::service::nats_client &nats) override
 Compensate completed steps in reverse order.
 
const std::string & failure_reason () const override
 Human-readable reason for a failed execution.
 
const messaging::provision_parties_responseresult () const
 Returns the provisioning result.
 

Detailed Description

Saga executor for the provision_parties workflow.

For each party in the request, executes three steps in order: 0. refdata.v1.parties.save — creates the party record

  1. iam.v1.accounts.save — creates the IAM account
  2. iam.v1.account-parties.save — links the account to the party

On failure, compensates completed steps in reverse order:

The workflow_id passed at construction is used as the parent FK when writing workflow_step records to the database.

Constructor & Destructor Documentation

◆ provision_parties_workflow()

provision_parties_workflow ( boost::uuids::uuid  workflow_id,
messaging::provision_parties_request  request,
std::string  correlation_id 
)

Constructs the executor.

Parameters
workflow_idUUID of the parent workflow instance (already created by the handler before calling execute()).
requestDecoded inbound provisioning request.

Member Function Documentation

◆ execute()

bool execute ( ores::database::context  ctx,
ores::nats::service::nats_client nats 
)
overridevirtual

Execute all saga steps in order.

Parameters
ctxPer-request database context for writing step records.
natsAuthenticated NATS client (with delegation) for calling downstream services.
Returns
true on full success; false if any step fails (executor has already stored the error via error()).

Implements workflow_executor.

Here is the caller graph for this function:

◆ compensate()

void compensate ( ores::database::context  ctx,
ores::nats::service::nats_client nats 
)
overridevirtual

Compensate completed steps in reverse order.

Called by the handler when execute() returns false. Must be idempotent.

Parameters
ctxPer-request database context.
natsAuthenticated NATS client (with delegation).

Implements workflow_executor.

Here is the caller graph for this function:

◆ failure_reason()

const std::string & failure_reason ( ) const
overridevirtual

Human-readable reason for a failed execution.

Valid only after execute() returns false.

Implements workflow_executor.

Here is the caller graph for this function:

◆ result()

const messaging::provision_parties_response & result ( ) const

Returns the provisioning result.

Valid only after execute() returns true.

Here is the caller graph for this function: