Channel
Namespace: E2E.Decision.Sdk
public sealed class ChannelA named channel that delivers each published message to its subscribers (diagnosticsChannel.channel).
Inheritance: object
Properties
Section titled “Properties”HasSubscribers
Section titled “HasSubscribers”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
Methods
Section titled “Methods”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<T> 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> |
Publish(object)
Section titled “Publish(object)”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 |
RunStores<T>(object, Func<T>)
Section titled “RunStores<T>(object, Func<T>)”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
Subscribe(Action<object>)
Section titled “Subscribe(Action<object>)”public void Subscribe(Action<object> subscriber)channel.subscribe.
Parameters
| Name | Type | Description |
|---|---|---|
subscriber |
Action<object> |
UnbindStore<T>(AsyncLocal<T?>)
Section titled “UnbindStore<T>(AsyncLocal<T?>)”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
Unsubscribe(Action<object>)
Section titled “Unsubscribe(Action<object>)”public bool Unsubscribe(Action<object> subscriber)channel.unsubscribe. Returns whether the subscriber was subscribed.
Parameters
| Name | Type | Description |
|---|---|---|
subscriber |
Action<object> |
Returns: bool