ores.trading.service

Table of Contents

1. Diagram

ores.trading.service component diagram

Figure 1: ores.trading.service

2. Summary

ores.trading.service is the NATS service entrypoint for the trading domain. It is a thin wiring layer: it reads configuration, opens database and NATS connections, registers all message handlers from ores.trading.core, and runs the event loop. All business logic lives in ores.trading.core; this component is responsible only for bootstrap, dependency injection, and graceful shutdown.

3. Inputs

  • Configuration file: NATS server URL, PostgreSQL connection string, logging settings, and environment name.
  • NATS request messages from UI clients and peer services on the ores.trading.* subject hierarchy.

4. Outputs

  • A running NATS service handling all trading operations (0x5000–0x5FFF range).
  • NATS response messages returned to callers.
  • Structured logs to the configured log sink via ores.logging.

5. Entry points

  • src/main.cpp — process entry point; initialises logging and starts the application.
  • src/application.cpp — bootstraps all subsystems and wires dependencies.
  • src/host.cpp — manages the NATS connection and handler registration loop.
  • src/config/ — configuration parsing and validation.

6. Dependencies

  • ores.trading.core — all NATS handlers, repositories, and domain services.
  • ores.trading.api — shared protocol types.
  • ores.logging — structured logging infrastructure.
  • nats.c — NATS client for connection management.

7. Build dependencies

What the shared profile cannot know, declared here rather than hand-edited into the generated build file. Each block is spliced into its generated file after the profile's baseline.

8. Options

The options this service takes beyond logging, NATS and the database. Codegen writes the member, its wire field, its command-line declaration and its assignment from each entry.

8.1. http_base_url

Base URL of the storage HTTP API, e.g. "http://localhost:8080".

Used by export-to-storage handlers to upload serialised data blobs.

9. See also

10. Test dependencies

The suites link what the profile cannot know about.

target_link_libraries(${lib_target_name}
    PUBLIC
        ores.service.lib
        ores.security.lib
        ores.trading.core.lib
        ores.eventing.core.lib
        ores.nats.lib
        ores.database.lib
        ores.utility.lib
        ores.telemetry.core.lib)
target_link_libraries(${tests_target_name}
    PRIVATE
        ${lib_target_name}
        ores.utility.lib
        ores.refdata.core.lib
        ores.storage.core.lib
        ores.refdata.core.lib
        ores.testing.lib
        ores.logging.lib
        Catch2::Catch2
        faker-cxx::faker-cxx
        Threads::Threads)

Emacs 29.3 (Org mode 9.6.15)