Class RedisMessageTransport
- All Implemented Interfaces:
MessageTransport, AutoCloseable
Publishing borrows a pooled connection and issues PUBLISH channel bytes;
receiving runs a dedicated daemon thread blocked in SUBSCRIBE, reconnecting
with backoff when the connection drops. Redis fans a message out to every
subscriber, so MessageEnvelope carries the Target
and the bus filters on receipt.
This class references Jedis types directly and is only loaded when the Redis transport is selected, keeping Jedis an optional dependency of the messaging module.
-
Nested Class Summary
Nested classes/interfaces inherited from interface MessageTransport
MessageTransport.EnvelopeSink -
Constructor Summary
ConstructorsConstructorDescriptionRedisMessageTransport(RedisConfig.Redis config, MessageCodec codec, PlatformLogger logger) Creates a Redis transport from resolved settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops the transport and releases resources.booleanReturns whether the transport is currently connected/operational.name()Human-readable transport name for diagnostics/logging (for example "plugin-messaging", "redis").voidpublish(MessageEnvelope envelope) Publishes an encoded envelope to the network.voidStarts the transport and begins delivering received envelopes to the sink.
-
Constructor Details
-
RedisMessageTransport
Creates a Redis transport from resolved settings.- Parameters:
config- redis settingscodec- envelope codeclogger- platform logger
-
-
Method Details
-
name
Description copied from interface:MessageTransportHuman-readable transport name for diagnostics/logging (for example "plugin-messaging", "redis").- Specified by:
namein interfaceMessageTransport- Returns:
- transport name
-
start
Description copied from interface:MessageTransportStarts the transport and begins delivering received envelopes to the sink.Called once before any
MessageTransport.publish(MessageEnvelope). Implementations that need a background subscriber thread or channel registration set it up here.- Specified by:
startin interfaceMessageTransport- Parameters:
sink- destination for received envelopes
-
publish
Description copied from interface:MessageTransportPublishes an encoded envelope to the network.The envelope's
Targetis advisory; transports that cannot route precisely broadcast and rely on receiver-side filtering.- Specified by:
publishin interfaceMessageTransport- Parameters:
envelope- envelope to send
-
isConnected
public boolean isConnected()Description copied from interface:MessageTransportReturns whether the transport is currently connected/operational.The default plugin-messaging transport reports connectivity based on whether the platform channel is registered; Redis reports pool health.
- Specified by:
isConnectedin interfaceMessageTransport- Returns:
- true when the transport can currently deliver messages
-
close
public void close()Description copied from interface:MessageTransportStops the transport and releases resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMessageTransport
-