A2uiCoreMessageProcessor


public final class A2uiCoreMessageProcessor implements A2uiMessageProcessor


The central orchestration engine for the A2UI core data layer.

It receives parsed protocol messages from the host application, routes them to the appropriate sequential A2uiCoreSurfaceActor, and exposes the outbound network events back to the host framework.

Summary

Public constructors

A2uiCoreMessageProcessor(
    @NonNull List<@NonNull A2uiCoreCatalog> catalogs,
    @NonNull Function0<@NonNull A2uiCoreDataModel> dataModelFactory,
    @NonNull Function0<@NonNull A2uiCoreComponentRegistry> componentRegistryFactory,
    @NonNull List<@NonNull A2uiActionInterceptor> actionInterceptors
)

Public methods

void

Continuously consumes the inbound message queue and routes messages to surface actors.

@NonNull StateFlow<@NonNull List<@NonNull A2uiSurfaceModel>>

A flow of the list of active surface ids currently managed by the processor.

final @NonNull A2uiClientCapabilities

The client capabilities supported by this processor instance, derived from the registered catalogs.

@NonNull Flow<@NonNull A2uiClientToServerMessage>

A flow of user actions and error payloads to be transmitted to the server.

void

Enqueues a client error message to be transmitted back to the server via outboundEvents.

void

Enqueues a parsed protocol message to be processed by the core engine.

Public constructors

A2uiCoreMessageProcessor

public A2uiCoreMessageProcessor(
    @NonNull List<@NonNull A2uiCoreCatalog> catalogs,
    @NonNull Function0<@NonNull A2uiCoreDataModel> dataModelFactory,
    @NonNull Function0<@NonNull A2uiCoreComponentRegistry> componentRegistryFactory,
    @NonNull List<@NonNull A2uiActionInterceptor> actionInterceptors
)
Parameters
@NonNull List<@NonNull A2uiCoreCatalog> catalogs

The list of available component catalogs.

@NonNull Function0<@NonNull A2uiCoreDataModel> dataModelFactory

Factory for creating new instances of A2uiCoreDataModel.

@NonNull Function0<@NonNull A2uiCoreComponentRegistry> componentRegistryFactory

Factory for creating new instances of A2uiCoreComponentRegistry.

@NonNull List<@NonNull A2uiActionInterceptor> actionInterceptors

A list of A2uiActionInterceptor instances to intercept UI actions.

Public methods

collectMessages

Added in 1.0.0-alpha01
public void collectMessages()

Continuously consumes the inbound message queue and routes messages to surface actors.

This function must be launched within the host application's lifecycle scope (e.g., a ViewModel scope). When the scope is cancelled, this loop and all child surface actors are naturally terminated.

getActiveSurfaces

Added in 1.0.0-alpha01
public @NonNull StateFlow<@NonNull List<@NonNull A2uiSurfaceModel>> getActiveSurfaces()

A flow of the list of active surface ids currently managed by the processor.

getClientCapabilities

Added in 1.0.0-alpha01
public final @NonNull A2uiClientCapabilities getClientCapabilities()

The client capabilities supported by this processor instance, derived from the registered catalogs. Host applications can query this directly during system initialization to send to the agent.

getOutboundEvents

Added in 1.0.0-alpha01
public @NonNull Flow<@NonNull A2uiClientToServerMessagegetOutboundEvents()

A flow of user actions and error payloads to be transmitted to the server.

processError

Added in 1.0.0-alpha01
public void processError(@NonNull A2uiClientErrorMessage error)

Enqueues a client error message to be transmitted back to the server via outboundEvents.

Parameters
@NonNull A2uiClientErrorMessage error

The client error message to transmit.

processMessage

Added in 1.0.0-alpha01
public void processMessage(@NonNull A2uiServerToClientMessage message)

Enqueues a parsed protocol message to be processed by the core engine.

This method is safe to call from any thread.