Package io.gridgo.core.impl
Class AbstractGatewaySubscription
- java.lang.Object
-
- io.gridgo.framework.impl.AbstractComponentLifecycle
-
- io.gridgo.core.impl.AbstractGatewaySubscription
-
- All Implemented Interfaces:
io.gridgo.connector.support.MessageProducer
,Gateway
,ProducerTemplateAware<GatewaySubscription>
,Streamable<RoutingContext>
,GatewaySubscription
,io.gridgo.framework.ComponentLifecycle
,io.gridgo.framework.NamedComponent
,io.gridgo.utils.helper.Loggable
- Direct Known Subclasses:
DefaultGateway
public abstract class AbstractGatewaySubscription extends io.gridgo.framework.impl.AbstractComponentLifecycle implements Gateway, GatewaySubscription
-
-
Constructor Summary
Constructors Constructor Description AbstractGatewaySubscription(GridgoContext context, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.reactivex.Observable<RoutingContext>
asObservable()
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.protected java.lang.String
generateName()
Gateway
get()
Get the Gateway associated with this subscription.java.util.List<ConnectorAttachment>
getConnectorAttachments()
Get the list of attached connectors.GridgoContext
getContext()
java.lang.String
getName()
RoutingPolicyEnforcer[]
getPolicyEnforcers()
io.reactivex.subjects.Subject<RoutingContext>
getSubject()
java.util.List<ProcessorSubscription>
getSubscriptions()
Get the list of subscriptions attached to this gatewayprotected void
onStart()
protected void
onStop()
protected void
publish(ConnectorAttachment connectorAttachment, io.gridgo.framework.support.Message msg, org.joo.promise4j.Deferred<io.gridgo.framework.support.Message,java.lang.Exception> deferred)
ProcessorSubscription
subscribe(Processor processor)
Subscribe a processor so that it can receive messages from the gateway's attached connectors.-
Methods inherited from class io.gridgo.framework.impl.AbstractComponentLifecycle
isStarted, start, stop, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.gridgo.core.Gateway
callAndPush, isAutoStart, push
-
Methods inherited from interface io.gridgo.core.support.subscription.GatewaySubscription
setAutoStart, setProducerInstrumenter
-
Methods inherited from interface io.gridgo.connector.support.MessageProducer
call, callAny, callAny, send, sendAny, sendAny, sendAnyWithAck, sendAnyWithAck, sendWithAck
-
Methods inherited from interface io.gridgo.core.support.ProducerTemplateAware
setProducerTemplate
-
-
-
-
Constructor Detail
-
AbstractGatewaySubscription
public AbstractGatewaySubscription(GridgoContext context, java.lang.String name)
-
-
Method Detail
-
attachConnector
public ConnectorAttachment attachConnector(java.lang.String endpoint)
Description copied from interface:GatewaySubscription
Attach a connector to the gateway with an endpoint.- Specified by:
attachConnector
in interfaceGatewaySubscription
- Parameters:
endpoint
- the endpoint- Returns:
- the connector attachment
-
attachConnector
public ConnectorAttachment attachConnector(java.lang.String endpoint, io.gridgo.connector.ConnectorResolver resolver)
Description copied from interface:GatewaySubscription
Attach a connector to the gateway with an endpoint using a custom resolver.- Specified by:
attachConnector
in interfaceGatewaySubscription
- Parameters:
endpoint
- the endpointresolver
- the resolver- Returns:
- the connector attachment
-
attachConnector
public ConnectorAttachment attachConnector(java.lang.String endpoint, io.gridgo.connector.support.config.ConnectorContext connectorContext)
Description copied from interface:GatewaySubscription
Attach a connector to the gateway with an endpoint and a context.- Specified by:
attachConnector
in interfaceGatewaySubscription
- Parameters:
endpoint
- the endpointconnectorContext
- the context- Returns:
- the connector attachment
-
attachConnector
public ConnectorAttachment attachConnector(java.lang.String endpoint, io.gridgo.connector.ConnectorResolver resolver, io.gridgo.connector.support.config.ConnectorContext connectorContext)
Description copied from interface:GatewaySubscription
Attach a connector to the gateway with an endpoint and a context using a custom resolver.- Specified by:
attachConnector
in interfaceGatewaySubscription
- Parameters:
endpoint
- the endpointresolver
- the resolverconnectorContext
- the context- Returns:
- the connector attachment
-
attachConnector
public ConnectorAttachment attachConnector(io.gridgo.connector.Connector connector)
Description copied from interface:GatewaySubscription
Attach a connector object to the gateway.- Specified by:
attachConnector
in interfaceGatewaySubscription
- Parameters:
connector
- the connector- Returns:
- the connector attachment
-
publish
protected void publish(ConnectorAttachment connectorAttachment, io.gridgo.framework.support.Message msg, org.joo.promise4j.Deferred<io.gridgo.framework.support.Message,java.lang.Exception> deferred)
-
attachRoutingPolicy
public GatewaySubscription attachRoutingPolicy(RoutingPolicy policy)
Description copied from interface:GatewaySubscription
Attach a routing policy to the gateway.- Specified by:
attachRoutingPolicy
in interfaceGatewaySubscription
- Parameters:
policy
- the policy- Returns:
- the GatewaySubscription itself
-
subscribe
public ProcessorSubscription subscribe(Processor processor)
Description copied from interface:GatewaySubscription
Subscribe a processor so that it can receive messages from the gateway's attached connectors.- Specified by:
subscribe
in interfaceGatewaySubscription
- Parameters:
processor
- the processor- Returns:
- the ProcessorSubscription
-
asObservable
public io.reactivex.Observable<RoutingContext> asObservable()
- Specified by:
asObservable
in interfaceStreamable<RoutingContext>
-
get
public Gateway get()
Description copied from interface:GatewaySubscription
Get the Gateway associated with this subscription.- Specified by:
get
in interfaceGatewaySubscription
- Returns:
- the associated gateway
-
onStart
protected void onStart()
- Specified by:
onStart
in classio.gridgo.framework.impl.AbstractComponentLifecycle
-
onStop
protected void onStop()
- Specified by:
onStop
in classio.gridgo.framework.impl.AbstractComponentLifecycle
-
generateName
protected java.lang.String generateName()
- Specified by:
generateName
in classio.gridgo.framework.impl.AbstractComponentLifecycle
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceio.gridgo.framework.NamedComponent
- Overrides:
getName
in classio.gridgo.framework.impl.AbstractComponentLifecycle
-
getContext
public GridgoContext getContext()
-
getConnectorAttachments
public java.util.List<ConnectorAttachment> getConnectorAttachments()
Description copied from interface:Gateway
Get the list of attached connectors.- Specified by:
getConnectorAttachments
in interfaceGateway
- Returns:
- the list of attached connectors
-
getSubscriptions
public java.util.List<ProcessorSubscription> getSubscriptions()
Description copied from interface:GatewaySubscription
Get the list of subscriptions attached to this gateway- Specified by:
getSubscriptions
in interfaceGatewaySubscription
- Returns:
- the list of subscriptions
-
getPolicyEnforcers
public RoutingPolicyEnforcer[] getPolicyEnforcers()
-
getSubject
public io.reactivex.subjects.Subject<RoutingContext> getSubject()
-
-