Class DefaultGridgoContext

  • All Implemented Interfaces:
    GridgoContext, GatewayContainer, io.gridgo.framework.ComponentLifecycle, io.gridgo.framework.NamedComponent, io.gridgo.utils.helper.Loggable

    public class DefaultGridgoContext
    extends io.gridgo.framework.impl.AbstractComponentLifecycle
    implements GridgoContext
    • Constructor Detail

      • DefaultGridgoContext

        protected DefaultGridgoContext​(java.lang.String name,
                                       io.gridgo.connector.ConnectorFactory connectorFactory,
                                       io.gridgo.framework.support.Registry registry,
                                       java.util.function.Consumer<java.lang.Throwable> exceptionHandler)
    • Method Detail

      • openGateway

        public GatewaySubscription openGateway​(java.lang.String name,
                                               ProducerTemplate producerTemplate)
        Description copied from interface: GatewayContainer
        Open a new gateway with a specific producer template.
        Specified by:
        openGateway in interface GatewayContainer
        Parameters:
        name - the gateway name
        producerTemplate - the producer template
        Returns:
        the gateway subscription
      • closeGateway

        public java.util.Optional<Gateway> closeGateway​(java.lang.String name)
        Description copied from interface: GatewayContainer
        Close a gateway, stopping it from accepting or sending messages.
        Specified by:
        closeGateway in interface GatewayContainer
        Parameters:
        name - the gateway name to be closed
        Returns:
        the closed gateway, wrapped in Optional
      • findGateway

        public java.util.Optional<Gateway> findGateway​(java.lang.String name)
        Description copied from interface: GatewayContainer
        Find a gateway by name.
        Specified by:
        findGateway in interface GatewayContainer
        Parameters:
        name - the gateway name
        Returns:
        the gateway, wrapped in Optional
      • onStart

        protected void onStart()
        Specified by:
        onStart in class io.gridgo.framework.impl.AbstractComponentLifecycle
      • onStop

        protected void onStop()
        Specified by:
        onStop in class io.gridgo.framework.impl.AbstractComponentLifecycle
      • generateName

        protected java.lang.String generateName()
        Specified by:
        generateName in class io.gridgo.framework.impl.AbstractComponentLifecycle
      • getRegistry

        public io.gridgo.framework.support.Registry getRegistry()
        Specified by:
        getRegistry in interface GridgoContext
      • getExceptionHandler

        public java.util.function.Consumer<java.lang.Throwable> getExceptionHandler()
        Specified by:
        getExceptionHandler in interface GridgoContext