Class Ladder
An ordered set of transports backed by an offline buffer.
public sealed class Ladder : IDisposable
- Inheritance
-
Ladder
- Implements
- Inherited Members
Remarks
A ladder is the answer to a node that has more than one way to reach the network and no single one that always works: rungs are tried in the order they were added, cheapest first, and a message no rung accepts goes into a buffer rather than being lost.
Constructors
Ladder(Store)
Creates a ladder with no rungs, buffering into a store.
public Ladder(Store store)
Parameters
storeStoreThe buffer, consumed by this call.
Exceptions
- PamojaException
The native ladder could not be created.
Methods
BufferedAsync()
Reports how many messages are waiting in the buffer.
public Task<int> BufferedAsync()
Returns
Exceptions
- PamojaException
The native call failed.
ConnectAsync()
Connects every rung, so a send can be tried against each in turn.
public Task ConnectAsync()
Returns
Remarks
A rung that will not connect is left in the ladder: it may come back, and a send simply falls through it until it does.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FlushAsync()
Replays the buffer over the rungs, oldest message first.
public Task<int> FlushAsync()
Returns
Exceptions
- PamojaException
The native call failed.
Rung(Transport)
Adds a rung, which is tried after the rungs already added.
public void Rung(Transport transport)
Parameters
transportTransportThe transport to add, consumed by this call.
Remarks
Add the cheapest, most-preferred link first and the costliest fallback last, because a send takes the first rung that accepts it.
Exceptions
- PamojaException
The transport was already handed on.
SendAsync(string, ReadOnlyMemory<byte>)
Sends a payload, buffering it if no rung takes it.
public Task<Delivery> SendAsync(string topic, ReadOnlyMemory<byte> payload)
Parameters
topicstringThe destination topic.
payloadReadOnlyMemory<byte>The bytes to send.
Returns
Exceptions
- PamojaException
The native call failed.