Class DefaultGenericGateway
- All Implemented Interfaces:
Namespaced<GenericGateway>, GenericGateway, HasLocalHandlers, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultGenericGateway(Client client, GatewayClient gatewayClient, RequestHandler requestHandler, Serializer serializer, DispatchInterceptor dispatchInterceptor, io.fluxzero.common.MessageType messageType, String topic, HandlerRegistry localHandlerRegistry, ResponseMapper responseMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this gateway and releases any underlying resources.protected GenericGatewaycreateForNamespace(String namespace) protected CompletableFuture<Message> sendAndForget(io.fluxzero.common.Guarantee guarantee, Message... messages) Sends multipleMessageobjects with a guarantee.sendAndForget(io.fluxzero.common.Guarantee guarantee, UnaryOperator<io.fluxzero.common.api.SerializedMessage> interceptor, Message... messages) Sends multipleMessageobjects with a guarantee.<R> RsendAndWait(Message message) Sends a message and blocks for a result with a configurable timeout.<R> RsendAndWait(Object input) Sends a message and blocks until a response is received.<R> RsendAndWait(Object payload, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee) Sends a request with a per-call publication guarantee and waits for its business response.sendForMessage(Message message, Duration timeout) Sends a single request message with the given effective timeout.sendForMessage(Message message, Duration timeout, io.fluxzero.common.Guarantee guarantee) Sends a full request with a per-call publication guarantee and effective timeout.sendForMessages(io.fluxzero.common.Guarantee guarantee, Message... messages) Sends full request messages with one publication guarantee and returns business response futures in input order.sendForMessages(Message... messages) Sends multiple messages and returns futures for their fullMessageresponses.setRetentionTime(Duration duration, io.fluxzero.common.Guarantee guarantee) Set a new retention duration for the underlying gateway's message log.truncate(io.fluxzero.common.Guarantee guarantee) Truncates this gateway's message log and clears associated tracking positions.withDefaultGuarantee(io.fluxzero.common.Guarantee guarantee) Configures the concrete application delivery default before first use.withRequestGuarantee(io.fluxzero.common.Guarantee guarantee) Configures remote request/reply delivery before first use.withShutdownTimeout(Supplier<Duration> timeout) Sets the response grace period supplier before first use; namespace-specific gateways inherit it when created.Methods inherited from class AbstractNamespaced
forNamespaceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GenericGateway
send, send, send, send, send, send, send, send, sendAndForget, sendAndForget, sendAndForget, sendAndForget, sendAndForget, sendAndForget, sendAndWait, sendAndWait, sendAndWait, sendAndWait, sendForMessage, setRetentionTime, truncateMethods inherited from interface HasLocalHandlers
hasLocalHandlers, registerHandler, registerHandler, setSelfHandlerFilterMethods inherited from interface Namespaced
forApplicationNamespace, forDefaultNamespace, forNamespace
-
Constructor Details
-
DefaultGenericGateway
public DefaultGenericGateway(Client client, GatewayClient gatewayClient, RequestHandler requestHandler, Serializer serializer, DispatchInterceptor dispatchInterceptor, io.fluxzero.common.MessageType messageType, String topic, HandlerRegistry localHandlerRegistry, ResponseMapper responseMapper)
-
-
Method Details
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<GenericGateway>
-
sendAndForget
public CompletableFuture<Void> sendAndForget(io.fluxzero.common.Guarantee guarantee, Message... messages) Description copied from interface:GenericGatewaySends multipleMessageobjects with a guarantee.- Specified by:
sendAndForgetin interfaceGenericGateway
-
sendAndForget
public CompletableFuture<Void> sendAndForget(io.fluxzero.common.Guarantee guarantee, UnaryOperator<io.fluxzero.common.api.SerializedMessage> interceptor, Message... messages) Description copied from interface:GenericGatewaySends multipleMessageobjects with a guarantee.Before the messages are appended to the message log in Fluxzero, they can be inspected, blocked or modified using the given interceptor.
- Specified by:
sendAndForgetin interfaceGenericGateway
-
sendForMessages
Description copied from interface:GenericGatewaySends multiple messages and returns futures for their fullMessageresponses.- Specified by:
sendForMessagesin interfaceGenericGateway
-
sendForMessages
public List<CompletableFuture<Message>> sendForMessages(io.fluxzero.common.Guarantee guarantee, Message... messages) Description copied from interface:GenericGatewaySends full request messages with one publication guarantee and returns business response futures in input order. Custom gateways retain their existing batch behavior forDEFAULT; unsupported explicit guarantees fail.- Specified by:
sendForMessagesin interfaceGenericGateway
-
sendAndWait
Description copied from interface:GenericGatewaySends a message and blocks until a response is received.- Specified by:
sendAndWaitin interfaceGenericGateway
-
sendAndWait
Description copied from interface:GenericGatewaySends a message and blocks for a result with a configurable timeout.Timeout can be customized using
@Timeouton the payload class.- Specified by:
sendAndWaitin interfaceGenericGateway
-
sendAndWait
public <R> R sendAndWait(Object payload, io.fluxzero.common.api.Metadata metadata, io.fluxzero.common.Guarantee guarantee) Description copied from interface:GenericGatewaySends a request with a per-call publication guarantee and waits for its business response. Storage acknowledgment does not replace or delay an already available business response.- Specified by:
sendAndWaitin interfaceGenericGateway
-
sendForMessage
Description copied from interface:GenericGatewaySends a single request message with the given effective timeout.The effective timeout is used for the returned future and is propagated as request metadata so tracking handlers can skip stale indexed requests before invocation. If
timeoutisnull, the gateway falls back to timeout metadata already present on the message, then@Timeouton the payload class, and finally the request handler default. A negative timeout disables timeout handling for this request.- Specified by:
sendForMessagein interfaceGenericGateway- Parameters:
message- the message to sendtimeout- the timeout for this request;nulluses the gateway/request handler defaults- Returns:
- a future that completes with the response message
-
sendForMessage
public CompletableFuture<Message> sendForMessage(Message message, Duration timeout, io.fluxzero.common.Guarantee guarantee) Description copied from interface:GenericGatewaySends a full request with a per-call publication guarantee and effective timeout. Timeout interpretation is identical toGenericGateway.sendForMessage(Message, Duration). Custom gateways retain their existing timeout behavior forDEFAULT; unsupported explicit guarantees fail.- Specified by:
sendForMessagein interfaceGenericGateway
-
setRetentionTime
public CompletableFuture<Void> setRetentionTime(Duration duration, io.fluxzero.common.Guarantee guarantee) Description copied from interface:GenericGatewaySet a new retention duration for the underlying gateway's message log.The retention setting determines how long messages in this log are retained by the system, after which they may be evicted or deleted depending on the platform policy.
- Specified by:
setRetentionTimein interfaceGenericGateway- Parameters:
duration- the new retention durationguarantee- the delivery guarantee to apply to the update operation- Returns:
- a
CompletableFuturethat completes according to the selected delivery guarantee
-
truncate
Description copied from interface:GenericGatewayTruncates this gateway's message log and clears associated tracking positions.- Specified by:
truncatein interfaceGenericGateway- Parameters:
guarantee- the delivery guarantee to apply to the truncate operation- Returns:
- a
CompletableFuturethat completes according to the selected delivery guarantee
-
emptyReturnMessage
-
withRequestGuarantee
Configures remote request/reply delivery before first use. Direct construction defaults toSENT; the standard builder resolvesfluxzero.publishing.requestGuaranteeand the defaults version from its own property source. Namespace gateways inherit this value. Business response completion does not await storage.- Parameters:
guarantee-SENTfor compatibility orSTOREDfor storage-acknowledged publication- Returns:
- this gateway
-
withDefaultGuarantee
Configures the concrete application delivery default before first use. Namespace gateways inherit this value. The standard builder resolvesfluxzero.publishing.defaultGuaranteefrom its own property source. Request/reply publication useswithRequestGuarantee(Guarantee)independently of this default.- Parameters:
guarantee- concrete delivery guarantee;DEFAULTis not allowed- Returns:
- this gateway
-
withShutdownTimeout
Sets the response grace period supplier before first use; namespace-specific gateways inherit it when created. This is a programmatic alternative toDefaultRequestHandler.SHUTDOWN_TIMEOUT_PROPERTY.- Parameters:
timeout- supplies a non-negative response grace period when closing; zero skips waiting for outstanding responses- Returns:
- this gateway
-
close
public void close()Description copied from interface:GenericGatewayCloses this gateway and releases any underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceGenericGateway- Overrides:
closein classAbstractNamespaced<GenericGateway>
-