glacez-soa-webservice
Lane: backend · Repo: glacez/glacez-soa-webservice · Editing rules: Glacez/SOAs/glacez-soa-webservice/AGENTS.md
The only API the webapps call, the security boundary, and an owning service in its own right — not a proxy.
Responsibility
| Area | What it means |
|---|---|
| API surface | REST resources per domain for the Vaadin apps, through the api-v1 Feign contracts |
| Security | OAuth2 resource server (Keycloak), role mapping, code-level ownership checks, quota enforcement. The only anonymous surface is /public/**, the API docs, and two actuator paths — health (chart probes) and prometheus (the ServiceMonitor scrape). Every other actuator endpoint (beans, metrics, info, env, shutdown) answers 401 |
| Ownership | user, credential, strategy, simulation, order/transfer record, track, event, note, wallet, investment profile, exchange info, external API key documents are its own |
| Orchestration | delegates computation and side effects to the five downstream SOAs |
| Event push | re-publishes state changes onto the UI fanout |
It does not own: portfolio math, strategy evaluation, exchange access, market data, LLM generation — each has an owning service.
Downstream
| Service | What webservice uses it for |
|---|---|
findata (/v2) |
prices, OHLCV, currencies, news |
core |
strategy control, synchronization job triggers |
worker |
exchange operations, record imports |
portfolio |
positions, distribution, snapshots |
agent |
LLM reports, profiles |
Credentials are encrypted at rest (jasypt) with a key from the environment; a decrypted credential is never logged.
A currency write crosses this service on its way to findata, and the delete guard lives here: GET /resources/currencies/{id}/references counts orders, transfers, strategies and notes (balance records are exchange snapshots, not positions, so they do not block), and a non-zero count blocks the delete with a 406. The full chain is in Currency lifecycle.
The same is true of transactions: history a user enters and live orders they send are written here, while strategy- and synchronisation-originated ones are written by core — the split and both chains are in Transaction lifecycle.
Data it writes
The largest set on the platform, because it is where user-initiated changes enter: GlacezUser, Credential, Strategy, Action/ActionTrack/StrategyTrack, Simulation*, the record types, Event, Note, Wallet, Order, Transfer, InvestmentProfile, ExchangeInfo, ExternalApiKey. It also reads other services' documents through its own repositories, which is the platform's read-directly discipline — see Data ownership.
RabbitMQ
Two independent flows:
- job production on the direct exchange — trading, simulations, records, emails
- event fanout on
glacez.events.fanout, which the Vaadin UI consumes directly; that is why the platform has no SSE endpoints
Runtime shape
WAR packaging executed with java -jar (ADR-004), @EnableWebMvc switching Boot's web auto-config off (ADR-003), three hand-written Jackson 3 converters that Feign and AMQP payloads ride on. Port 8081 locally; no scheduler of its own.
Quotas
Strategy, simulation, credential and wallet limits are checked in the service that creates them, from glacez.quota.*. A "limit reached" report is this service refusing, not a UI bug.
Error surface
Responses are shaped centrally: bad argument/Feign 400 → 400, not found → 404, not acceptable/not enough → 406, already exists → 409, exchange failure → 503, anything else → 500. A new exception type without a handler entry reaches the client as a 500, which is why this mapping is a contract rather than cosmetics.