Table of Contents

Interface ILink

Namespace
Pamoja.Core
Assembly
Pamoja.Core.dll

A link a program sends messages over and receives them from: the loopback, MQTT, CoAP, a transport ladder, or a transport of the program's own.

public interface ILink

A profile's node publishes each reading through SendAsync(string, ReadOnlyMemory<byte>), and a rule engine listens with SubscribeAsync(string) and ReceiveAsync(TimeSpan), so either runs over any link. Connect the link before handing it over.

Methods

Waits a limited time for the next message on a subscribed topic.

Task<TransportMessage?> ReceiveAsync(TimeSpan timeout)

Parameters

timeout TimeSpan

How long to wait.

Returns

Task<TransportMessage>

The message, or null once the link has ended.

Exceptions

TimeoutException

No message arrived in time.

Publishes one message to a topic.

Task SendAsync(string topic, ReadOnlyMemory<byte> payload)

Parameters

topic string

The destination topic.

payload ReadOnlyMemory<byte>

The bytes to send.

Returns

Task

A task that completes once the link has taken the message.

Subscribes to a topic.

Task SubscribeAsync(string topic)

Parameters

topic string

The topic, or a filter in the syntax the link understands.

Returns

Task

A task that completes once the subscription is placed.