Class InMemoryTransport
java.lang.Object
com.iantapply.relay.core.InMemoryTransport
- All Implemented Interfaces:
MessageTransport, AutoCloseable
Deterministic transport for contract tests and local embedding.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops publication and reception and releases transport resources.booleanReports current transport connectivity.Publishes bytes to one transport channel.longReturns the number of successful subscriber reconnections.voidstart(Collection<String> channels, BiConsumer<String, byte[]> receiver) Starts receiving messages from a fixed set of channels.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MessageTransport
publisherConnected, subscriberConnected
-
Constructor Details
-
InMemoryTransport
public InMemoryTransport()Creates a disconnected in-memory transport.
-
-
Method Details
-
publish
Description copied from interface:MessageTransportPublishes bytes to one transport channel.- Specified by:
publishin interfaceMessageTransport- Parameters:
channel- destination channelpayload- encoded Relay envelope- Returns:
- stage completed when the transport accepts the publication
-
start
Description copied from interface:MessageTransportStarts receiving messages from a fixed set of channels.- Specified by:
startin interfaceMessageTransport- Parameters:
channels- channels to consumereceiver- callback receiving a channel and encoded envelope
-
connected
public boolean connected()Description copied from interface:MessageTransportReports current transport connectivity.- Specified by:
connectedin interfaceMessageTransport- Returns:
truewhen connected
-
reconnects
public long reconnects()Description copied from interface:MessageTransportReturns the number of successful subscriber reconnections.- Specified by:
reconnectsin interfaceMessageTransport- Returns:
- reconnect count
-
close
public void close()Description copied from interface:MessageTransportStops publication and reception and releases transport resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMessageTransport
-