Package io.gridgo.core.impl
Class DefaultGateway
- java.lang.Object
-
- io.gridgo.framework.impl.AbstractComponentLifecycle
-
- io.gridgo.core.impl.AbstractGatewaySubscription
-
- io.gridgo.core.impl.DefaultGateway
-
- 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
public class DefaultGateway extends AbstractGatewaySubscription
-
-
Constructor Summary
Constructors Constructor Description DefaultGateway(GridgoContext context, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.joo.promise4j.Promise<io.gridgo.framework.support.Message,java.lang.Exception>call(io.gridgo.framework.support.Message message)voidcallAndPush(io.gridgo.framework.support.Message message)Send a message and wait for response.ProducerTemplategetProducerTemplate()booleanisAutoStart()Check if this gateway is auto-started.org.joo.promise4j.Promise<io.gridgo.framework.support.Message,java.lang.Exception>push(@NonNull io.gridgo.framework.support.Message message)Push a message to the gateway incoming sink, so it will be routed the subscribers.voidsend(io.gridgo.framework.support.Message message)org.joo.promise4j.Promise<io.gridgo.framework.support.Message,java.lang.Exception>sendWithAck(io.gridgo.framework.support.Message message)GatewaySubscriptionsetAutoStart(boolean autoStart)Set the gateway autoStart flag.GatewaySubscriptionsetProducerInstrumenter(io.gridgo.framework.execution.ProducerInstrumenter instrumenter)GatewaySubscriptionsetProducerTemplate(ProducerTemplate producerTemplate)-
Methods inherited from class io.gridgo.core.impl.AbstractGatewaySubscription
asObservable, attachConnector, attachConnector, attachConnector, attachConnector, attachConnector, attachRoutingPolicy, generateName, get, getConnectorAttachments, getContext, getName, getPolicyEnforcers, getSubject, getSubscriptions, onStart, onStop, publish, subscribe
-
Methods inherited from class io.gridgo.framework.impl.AbstractComponentLifecycle
isStarted, start, stop, toString
-
-
-
-
Constructor Detail
-
DefaultGateway
public DefaultGateway(GridgoContext context, java.lang.String name)
-
-
Method Detail
-
send
public void send(io.gridgo.framework.support.Message message)
-
sendWithAck
public org.joo.promise4j.Promise<io.gridgo.framework.support.Message,java.lang.Exception> sendWithAck(io.gridgo.framework.support.Message message)
-
call
public org.joo.promise4j.Promise<io.gridgo.framework.support.Message,java.lang.Exception> call(io.gridgo.framework.support.Message message)
-
callAndPush
public void callAndPush(io.gridgo.framework.support.Message message)
Description copied from interface:GatewaySend a message and wait for response. The response will then be pushed into the gateway incoming sink instead of returning to the caller. Some connectors might not support it. If there are multiple connectors attached to the gateway, only the first one is actually called, the rest are usualsend().- Parameters:
message- the message
-
push
public org.joo.promise4j.Promise<io.gridgo.framework.support.Message,java.lang.Exception> push(@NonNull @NonNull io.gridgo.framework.support.Message message)Description copied from interface:GatewayPush a message to the gateway incoming sink, so it will be routed the subscribers. The subscriber may or may not send back a response. If there is no response the promise will never be completed.- Parameters:
message- the message to be pushed- Returns:
- the promise
-
setProducerTemplate
public GatewaySubscription setProducerTemplate(ProducerTemplate producerTemplate)
-
setAutoStart
public GatewaySubscription setAutoStart(boolean autoStart)
Description copied from interface:GatewaySubscriptionSet the gateway autoStart flag.- Parameters:
autoStart- the autoStart value- Returns:
- the GatewaySubscription itself
-
setProducerInstrumenter
public GatewaySubscription setProducerInstrumenter(io.gridgo.framework.execution.ProducerInstrumenter instrumenter)
-
getProducerTemplate
public ProducerTemplate getProducerTemplate()
-
isAutoStart
public boolean isAutoStart()
Description copied from interface:GatewayCheck if this gateway is auto-started.- Returns:
- true if and only if the gateway is configured to be auto-started
-
-