ores.ore.ore_import_messages

Table of Contents

The ORE import protocol, both halves in one model. The caller uploads the packed ORE directory to object storage first, then sends the request; the service answers once the saga has run, or returns a workflow instance id when it has dispatched the import asynchronously.

The workflow engine then drives the saga itself, publishing the execute command when the workflow starts and the rollback command when compensation is triggered. The handler answers each by calling publish_step_completion, so neither command has a response type. The result is not sent over the wire either: it travels as the step's response_json, which is why it carries the saved entity identifiers the rollback needs.

Both halves are one model because they share ore_import_item_error. The generator resolves one model at a time, so a message in one operation model cannot be referenced from a second model's header or its TypeScript twin; a single model keeps the shared type local, and the service includes one header rather than two.

1. Physical space

The shell commands are switched off: the component has no part under projects/ores.shell, so a generated unit has nowhere to land. The import reaches a person through the hand-written ore menu, whose import verb uploads the package and then sends ore_import_request, and whose export verb sends the trading protocol's portfolio export.

2. Includes

#include <string>
#include <string_view>
#include <vector>

3. Messages

3.1. ore_import_item_error

/**
 * @brief Error for a single item within an ORE import.
 *
 * Carries the exact source file and item identifier so the caller can present
 * a precise failure location, such as "trades.xml / trade-0042".
 */

3.1.1. source_file

3.1.2. item_id

3.1.3. message

3.2. ore_import_request

/**
 * @brief Request to import an ORE directory already uploaded to storage.
 *
 * The caller uploads the packed directory to the platform bucket ores at
 * ore/imports/{request_id}.tar.gz before sending this message.
 */

3.2.1. request_id

/** UUID; also the storage key root. */

3.2.2. import_choices_json

3.2.3. correlation_id

3.3. ore_import_response

/**
 * @brief Response for an ore_import_request.
 *
 * On partial failure success is still true and item_errors is non-empty; a
 * false success means the saga itself failed and compensation ran.
 */

3.3.1. success

3.3.2. message

3.3.3. item_errors

3.3.4. correlation_id

/**
 * Set when the import was dispatched asynchronously through the workflow
 * engine. The import then runs in the background, item_errors is empty in
 * this response, and this id queries the workflow's status.
 */

3.3.5. workflow_instance_id

3.4. ore_import_execute_request

/**
 * @brief Workflow step command: execute the full ORE import.
 *
 * Published by the workflow engine when the ore_import_workflow starts. The
 * handler fetches the packed tarball, scans, plans and saves every item, then
 * calls publish_step_completion.
 */

3.4.1. request_id

3.4.2. import_choices_json

3.4.3. correlation_id

3.4.4. bearer_token

/** The caller's JWT, so the handler can delegate the caller's identity downstream. */

3.5. ore_import_execute_result

/**
 * @brief The step's stored response.
 *
 * Carries everything compensation needs -- the identifiers of every entity
 * the step saved -- alongside the caller-facing item_errors list.
 */

3.5.1. success

3.5.2. message

3.5.3. correlation_id

3.5.4. item_errors

3.5.5. saved_currency_iso_codes

3.5.6. saved_portfolio_names

3.5.7. saved_book_names

3.5.8. saved_trade_ids

/**
 * The id of each booked trade. The rollback closes these trades' bookings,
 * because a trade's anchor is immutable.
 */

3.6. ore_import_rollback_request

/**
 * @brief Workflow compensation command: roll back a completed ORE import.
 *
 * Published by the workflow engine when step 0's compensation is triggered.
 * The handler deletes every saved entity in reverse order and calls
 * publish_step_completion.
 */

3.6.1. correlation_id

3.6.2. bearer_token

/** The caller's JWT, so the handler can delegate the caller's identity downstream. */

3.6.3. saved_currency_iso_codes

3.6.4. saved_portfolio_names

3.6.5. saved_book_names

3.6.6. saved_trade_ids

/** The id of each booked trade, whose booking the rollback closes. */

4. See also

  • ores.ore — component group overview.

Emacs 29.3 (Org mode 9.6.15)