Table of Contents

Class Ladder

Namespace
Pamoja.Ladder
Assembly
Pamoja.Ladder.dll

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

store Store

The 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

Task<int>

The count.

Exceptions

PamojaException

The native call failed.

ConnectAsync()

Connects every rung, so a send can be tried against each in turn.

public Task ConnectAsync()

Returns

Task

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

Task<int>

How many buffered messages went out.

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

transport Transport

The 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

topic string

The destination topic.

payload ReadOnlyMemory<byte>

The bytes to send.

Returns

Task<Delivery>

Whether the message went out or was buffered.

Exceptions

PamojaException

The native call failed.