Interface GatewaySubscription
-
- All Superinterfaces:
ProducerTemplateAware<GatewaySubscription>
- All Known Implementing Classes:
AbstractGatewaySubscription
,DefaultGateway
public interface GatewaySubscription extends ProducerTemplateAware<GatewaySubscription>
Represents a gateway subscription. After a gateway is opened, you can attach connectors, routing policies and subscriber to it. A gateway can be started automatically when the context starts, or it can be lazily started withsetAutoStart(false)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConnectorAttachment
attachConnector(io.gridgo.connector.Connector connector)
Attach a connector object to the gateway.ConnectorAttachment
attachConnector(java.lang.String endpoint)
Attach a connector to the gateway with an endpoint.ConnectorAttachment
attachConnector(java.lang.String endpoint, io.gridgo.connector.ConnectorResolver resolver)
Attach a connector to the gateway with an endpoint using a custom resolver.ConnectorAttachment
attachConnector(java.lang.String endpoint, io.gridgo.connector.ConnectorResolver resolver, io.gridgo.connector.support.config.ConnectorContext connectorContext)
Attach a connector to the gateway with an endpoint and a context using a custom resolver.ConnectorAttachment
attachConnector(java.lang.String endpoint, io.gridgo.connector.support.config.ConnectorContext connectorContext)
Attach a connector to the gateway with an endpoint and a context.GatewaySubscription
attachRoutingPolicy(RoutingPolicy policy)
Attach a routing policy to the gateway.Gateway
get()
Get the Gateway associated with this subscription.java.util.List<ProcessorSubscription>
getSubscriptions()
Get the list of subscriptions attached to this gatewayGatewaySubscription
setAutoStart(boolean autoStart)
Set the gateway autoStart flag.GatewaySubscription
setProducerInstrumenter(io.gridgo.framework.execution.ProducerInstrumenter instrumenter)
ProcessorSubscription
subscribe(Processor processor)
Subscribe a processor so that it can receive messages from the gateway's attached connectors.-
Methods inherited from interface io.gridgo.core.support.ProducerTemplateAware
setProducerTemplate
-
-
-
-
Method Detail
-
attachConnector
ConnectorAttachment attachConnector(java.lang.String endpoint)
Attach a connector to the gateway with an endpoint.- Parameters:
endpoint
- the endpoint- Returns:
- the connector attachment
-
attachConnector
ConnectorAttachment attachConnector(java.lang.String endpoint, io.gridgo.connector.ConnectorResolver resolver)
Attach a connector to the gateway with an endpoint using a custom resolver.- Parameters:
endpoint
- the endpointresolver
- the resolver- Returns:
- the connector attachment
-
attachConnector
ConnectorAttachment attachConnector(java.lang.String endpoint, io.gridgo.connector.support.config.ConnectorContext connectorContext)
Attach a connector to the gateway with an endpoint and a context.- Parameters:
endpoint
- the endpointconnectorContext
- the context- Returns:
- the connector attachment
-
attachConnector
ConnectorAttachment attachConnector(java.lang.String endpoint, io.gridgo.connector.ConnectorResolver resolver, io.gridgo.connector.support.config.ConnectorContext connectorContext)
Attach a connector to the gateway with an endpoint and a context using a custom resolver.- Parameters:
endpoint
- the endpointresolver
- the resolverconnectorContext
- the context- Returns:
- the connector attachment
-
attachConnector
ConnectorAttachment attachConnector(io.gridgo.connector.Connector connector)
Attach a connector object to the gateway.- Parameters:
connector
- the connector- Returns:
- the connector attachment
-
attachRoutingPolicy
GatewaySubscription attachRoutingPolicy(RoutingPolicy policy)
Attach a routing policy to the gateway.- Parameters:
policy
- the policy- Returns:
- the GatewaySubscription itself
-
subscribe
ProcessorSubscription subscribe(Processor processor)
Subscribe a processor so that it can receive messages from the gateway's attached connectors.- Parameters:
processor
- the processor- Returns:
- the ProcessorSubscription
-
setAutoStart
GatewaySubscription setAutoStart(boolean autoStart)
Set the gateway autoStart flag.- Parameters:
autoStart
- the autoStart value- Returns:
- the GatewaySubscription itself
-
setProducerInstrumenter
GatewaySubscription setProducerInstrumenter(io.gridgo.framework.execution.ProducerInstrumenter instrumenter)
-
getSubscriptions
java.util.List<ProcessorSubscription> getSubscriptions()
Get the list of subscriptions attached to this gateway- Returns:
- the list of subscriptions
-
get
Gateway get()
Get the Gateway associated with this subscription.- Returns:
- the associated gateway
-
-