-
- All Implemented Interfaces:
-
io.github.cfraser.connekt.api.Transport,java.io.Closeable,java.lang.AutoCloseable
public abstract class Transport.Base implements Transport
Transport.Base is an internal abstract base class for Transport implementations.
The class implements receiveFrom and sendTo which initialize and cache each distributed channel for the source/destination queue.
A default Metrics tracking is also provided through the atomic counter properties messagesReceived, messagesSent, receiveErrors, and sendErrors.
-
-
Constructor Summary
Constructors Constructor Description Transport.Base()
-
Method Summary
Modifier and Type Method Description abstract Flow<ByteArray>receive(CoroutineScope $self, String queue)Receive the messages from the queue. abstract Unitsend(String queue, ByteArray byteArray)Send the message to the queue. ReceiveChannel<ByteArray>receiveFrom(String queue)Initialize a ReceiveChannel to receive messages from the queue in a GlobalScope coroutine. SendChannel<ByteArray>sendTo(String queue)Initialize a SendChannel to send messages to the queue in a GlobalScope coroutine. Metricsmetrics()Get the Metrics for the Transport from messagesReceived, messagesSent, receiveErrors, and sendErrors. -
-
Method Detail
-
receive
abstract Flow<ByteArray> receive(CoroutineScope $self, String queue)
Receive the messages from the queue.
- Parameters:
queue- the queue to receive messages from
-
send
abstract Unit send(String queue, ByteArray byteArray)
Send the message to the queue.
- Parameters:
queue- the queue to send the message tobyteArray- the ByteArray to send
-
receiveFrom
ReceiveChannel<ByteArray> receiveFrom(String queue)
Initialize a ReceiveChannel to receive messages from the queue in a GlobalScope coroutine.
Subsequent invocations of receiveFrom for a queue return the ReceiveChannel from the receiveChannels cache.
- Parameters:
queue- the queue to receive messages from
-
sendTo
SendChannel<ByteArray> sendTo(String queue)
Initialize a SendChannel to send messages to the queue in a GlobalScope coroutine.
Subsequent invocations of sendTo for a queue return the SendChannel from the sendChannels cache.
- Parameters:
queue- the queue to send messages to
-
-
-
-