docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AggregatorConnector

    An IConnector implementation that forwards all publish and subscribe operations to a set of underlying connectors simultaneously.

    Inheritance
    object
    AggregatorConnector
    Implements
    IConnector
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro.Foundation
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    public class AggregatorConnector : IConnector
    Remarks

    Use AggregatorConnector when messages should be sent to multiple backends (for example, a local DummyConnection for testing and a remote connector) at the same time. Subscribe calls are forwarded to all underlying connectors, as are services implemented with ImplementService<TRequest, TResponse>(string, Func<TRequest, TResponse>). A service call made through RegisterServiceClient<TRequest, TResponse>(string) has a single response, so it is delegated to the first connector rather than fanned out.

    Constructors

    AggregatorConnector(params IConnector[])

    Creates a new AggregatorConnector wrapping the specified connectors.

    Declaration
    public AggregatorConnector(params IConnector[] connectors)
    Parameters
    Type Name Description
    IConnector[] connectors

    The connectors to aggregate. All operations are forwarded to each.

    Properties

    HasConnectionError

    Gets a value indicating whether the connector is in an error state.

    Declaration
    public bool HasConnectionError { get; }
    Property Value
    Type Description
    bool

    Methods

    AddNewTopicsListener(Action<ITopicInfo>, bool)

    Add a callback to notify on any new topic.

    Declaration
    public void AddNewTopicsListener(Action<ITopicInfo> callback, bool notifyAllExistingTopics = false)
    Parameters
    Type Name Description
    Action<ITopicInfo> callback

    The callback Action to notify of any new topic

    bool notifyAllExistingTopics

    Indicates if the callback should be invoked immediately for all existing topics

    Connect()

    Opens the connection to the messaging backend.

    Declaration
    public void Connect()

    Disconnect()

    Closes the connection to the messaging backend and releases associated resources.

    Declaration
    public void Disconnect()

    GetAllTopics()

    Return all ITopicInfo ordered by topic name

    Declaration
    public IEnumerable<ITopicInfo> GetAllTopics()
    Returns
    Type Description
    IEnumerable<ITopicInfo>

    The IEnumerable collection of ITopicInfo

    GetTopicInfo(string, MessageDisambiguator)

    Gets the ITopicInfo for the specified topic

    Declaration
    public ITopicInfo GetTopicInfo(string topic, MessageDisambiguator disambiguator = MessageDisambiguator.Default)
    Parameters
    Type Name Description
    string topic

    The specified topic

    MessageDisambiguator disambiguator

    The disambiguator type for the IMessage

    Returns
    Type Description
    ITopicInfo

    The ITopicInfo for the specified topic

    ImplementService(string, MessageTypeId, MessageTypeId, Func<IMessage, IMessage>)

    Create the service listener to handle requests

    Declaration
    public void ImplementService(string serviceName, MessageTypeId requestTypeId, MessageTypeId responseTypeId, Func<IMessage, IMessage> callback)
    Parameters
    Type Name Description
    string serviceName

    The service name

    MessageTypeId requestTypeId

    The request message type id (name and disambiguator)

    MessageTypeId responseTypeId

    The response message type id (name and disambiguator)

    Func<IMessage, IMessage> callback

    The callback to handle the request and return the response

    Remarks

    The service is hosted on every aggregated connector, so a request arriving on any of them is answered by callback.

    ImplementService<TRequest, TResponse>(string, Func<TRequest, TResponse>)

    Create the service listener to handle requests

    Declaration
    public void ImplementService<TRequest, TResponse>(string serviceName, Func<TRequest, TResponse> callback) where TRequest : IMessage where TResponse : IMessage
    Parameters
    Type Name Description
    string serviceName

    The service name

    Func<TRequest, TResponse> callback

    The callback to handle the request and return the response

    Type Parameters
    Name Description
    TRequest

    The type of the IMessage request

    TResponse

    The type of the IMessage response

    Remarks

    The service is hosted on every aggregated connector, so a request arriving on any of them is answered by callback.

    RegisterPublisher(string, MessageTypeId)

    Create or get an IPublisher for the specified topic and message type name

    Declaration
    public IPublisher RegisterPublisher(string topic, MessageTypeId messageTypeId)
    Parameters
    Type Name Description
    string topic

    The specified topic

    MessageTypeId messageTypeId

    The message type id (name and disambiguator)

    Returns
    Type Description
    IPublisher

    The IPublisher

    RegisterPublisher<T>(string)

    Create or get an IPublisher for the specified topic and message type

    Declaration
    public IPublisher RegisterPublisher<T>(string topic) where T : IMessage
    Parameters
    Type Name Description
    string topic

    The specified topic

    Returns
    Type Description
    IPublisher

    The IPublisher

    Type Parameters
    Name Description
    T

    The type of the IMessage

    RegisterServiceClient(string, MessageTypeId, MessageTypeId)

    Create the service listener to handle requests

    Declaration
    public IServiceClient RegisterServiceClient(string serviceName, MessageTypeId requestTypeId, MessageTypeId responseTypeId)
    Parameters
    Type Name Description
    string serviceName

    The service name

    MessageTypeId requestTypeId

    The request message type id (name and disambiguator)

    MessageTypeId responseTypeId

    The response message type id (name and disambiguator)

    Returns
    Type Description
    IServiceClient

    A new IServiceClient for the specified service.

    Remarks

    Unlike a publisher, a service call has exactly one response, so the request cannot be fanned out. It is delegated to the first aggregated connector only — order the connectors so that the one that should answer service calls comes first.

    RegisterServiceClient<TRequest, TResponse>(string)

    Create the service client to send requests

    Declaration
    public IServiceClient RegisterServiceClient<TRequest, TResponse>(string serviceName) where TRequest : IMessage where TResponse : IMessage
    Parameters
    Type Name Description
    string serviceName

    The service name

    Returns
    Type Description
    IServiceClient

    A new IServiceClient for the specified service.

    Type Parameters
    Name Description
    TRequest

    The type of the IMessage request

    TResponse

    The type of the IMessage response

    Remarks

    Unlike a publisher, a service call has exactly one response, so the request cannot be fanned out. It is delegated to the first aggregated connector only — order the connectors so that the one that should answer service calls comes first.

    RequestTopicListRefresh()

    Refresh the topic list Clients may call this frequently, connector is responsible for doing sensible rate limiting

    Declaration
    public void RequestTopicListRefresh()

    Subscribe(string, MessageTypeId, Action<IMessage>)

    Subscribe a callback for the specified topic

    Declaration
    public void Subscribe(string topic, MessageTypeId messageTypeId, Action<IMessage> callback)
    Parameters
    Type Name Description
    string topic

    The specified topic

    MessageTypeId messageTypeId

    The message type id (name and disambiguator)

    Action<IMessage> callback

    The subscriber callback Action to handle an IMessage

    Subscribe<T>(string, Action<T>)

    Subscribe a callback for the specified topic

    Declaration
    public void Subscribe<T>(string topic, Action<T> callback) where T : IMessage
    Parameters
    Type Name Description
    string topic

    The specified topic

    Action<T> callback

    The subscriber callback Action to handle an IMessage

    Type Parameters
    Name Description
    T

    The type of the IMessage handled by the subscriber

    Implements

    IConnector
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)