Skip to content

Channel

Namespace: E2E.Decision.Sdk

public sealed class Channel

A named channel that delivers each published message to its subscribers (diagnosticsChannel.channel).

Inheritance: object

View source

public bool HasSubscribers { get; }

Whether a subscriber or a bound store would see a message.

Value: bool

public string Name { get; }

The channel’s name.

Value: string

BindStore<T>(AsyncLocal<T?>, Func<object, T?>)

Section titled “BindStore<T>(AsyncLocal<T?>, Func<object, T?>)”
public void BindStore<T>(AsyncLocal<T?> store, Func<object, T?> transform)

channel.bindStore: while RunStores&lt;T&gt; runs, <code class=“paramref”>store</code> holds what <code class=“paramref”>transform</code> returns for the message.

Type parameters

Name Description
T

Parameters

Name Type Description
store AsyncLocal<T>
transform Func<object, T>

public void Publish(object message)

channel.publish. A subscriber that throws does not affect the publisher or the other subscribers, as in Node, where the error is reported out of band.

Parameters

Name Type Description
message object

public T RunStores<T>(object message, Func<T> execute)

channel.runStores: binds the stores to the message, publishes it, and runs <code class=“paramref”>execute</code> inside them.

Type parameters

Name Description
T

Parameters

Name Type Description
message object
execute Func<T>

Returns: T

public void Subscribe(Action<object> subscriber)

channel.subscribe.

Parameters

Name Type Description
subscriber Action<object>

public bool UnbindStore<T>(AsyncLocal<T?> store)

channel.unbindStore. Returns whether the store was bound.

Type parameters

Name Description
T

Parameters

Name Type Description
store AsyncLocal<T>

Returns: bool

public bool Unsubscribe(Action<object> subscriber)

channel.unsubscribe. Returns whether the subscriber was subscribed.

Parameters

Name Type Description
subscriber Action<object>

Returns: bool