Interface MessageTransport
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryTransport
Byte-oriented publish/subscribe transport used by Relay's typed messaging layer.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops publication and reception and releases transport resources.booleanReports current transport connectivity.Publishes bytes to one transport channel.default booleanReports publication-side connectivity.longReturns the number of successful subscriber reconnections.voidstart(Collection<String> channels, BiConsumer<String, byte[]> receiver) Starts receiving messages from a fixed set of channels.default booleanReports subscription-side connectivity.
-
Method Details
-
publish
Publishes bytes to one transport channel.- Parameters:
channel- destination channelpayload- encoded Relay envelope- Returns:
- stage completed when the transport accepts the publication
-
start
Starts receiving messages from a fixed set of channels.- Parameters:
channels- channels to consumereceiver- callback receiving a channel and encoded envelope
-
connected
boolean connected()Reports current transport connectivity.- Returns:
truewhen connected
-
publisherConnected
default boolean publisherConnected()Reports publication-side connectivity.- Returns:
truewhen the transport can currently publish
-
subscriberConnected
default boolean subscriberConnected()Reports subscription-side connectivity.- Returns:
truewhen the transport is currently subscribed
-
reconnects
long reconnects()Returns the number of successful subscriber reconnections.- Returns:
- reconnect count
-
close
void close()Stops publication and reception and releases transport resources.- Specified by:
closein interfaceAutoCloseable
-