9 Architecture
Ralph Schaer edited this page 2026-10-30 16:08:52 +01:00

Architecture

The wamp2spring architecture is centered around Spring messaging channels. Transport adapters deserialize inbound WAMP frames, enrich them with transport and session metadata, and forward them into broker, dealer, and auxiliary processing components.

At a high level:

  • Transport adapters accept WebSocket frames and, on the servlet stack, optional long-poll requests
  • Session support establishes WAMP sessions, negotiates authentication, attaches identity and peer-role metadata, and publishes lifecycle events
  • Broker components handle subscriptions, publications, filtering, and event-oriented meta features
  • Dealer components handle registrations, invocations, progressive results, cancellation, timeouts, and RPC-oriented meta features
  • Spring-managed beans annotated with @WampProcedure and @WampListener integrate application code into the routing flow
  • WampPublisher provides the inverse direction for server-side publication into the broker

The transport and routing layers are decoupled so the same core semantics are shared across servlet and reactive deployments. Routing is performed in a single shared scope rather than being partitioned by realm.

flowchart TD
    Client[WAMP client] <--> Transport[Servlet WebSocket, reactive WebSocket, or servlet long poll]
    Transport --> Session[Session establishment and authentication]
    Transport --> Inbound[clientInboundChannel]
    Inbound --> Dealer[RpcMessageHandler]
    Inbound --> Broker[PubSubMessageHandler]
    Dealer --> Procedures[Java procedures and ProcedureRegistry]
    Broker --> Subscriptions[Java listeners and SubscriptionRegistry]
    Publisher[WampPublisher] --> BrokerChannel[brokerChannel]
    BrokerChannel --> Broker
    Dealer --> Outbound[clientOutboundChannel]
    Broker --> Outbound
    Outbound --> Transport

WampConfiguration creates the common channels, registries, handler-method service, publisher, event store, and conditional meta API beans. Servlet, reactive, and long-poll configurations add their transport adapters. The servlet WebSocket and long-poll paths share WampSessionSupport; the reactive handler implements its own session flow.

The inbound channel preserves processing order within each WAMP session. Outbound delivery uses a separate executor; server publication uses a synchronous broker channel by default. Configuration describes the executor hooks.

Registries, pending invocations, retained messages, and default history storage are in-process state. Sessions integrates HTTP session lifecycle but does not make the router distributed.

  • Auxiliary for connection setup, session management, and shared support components
  • RPC for dealer and procedure routing
  • Publish/Subscribe for broker and event routing

Source: core configuration.