Table of Contents

Class PubsubSubscriptionManager

Namespace
Virtufin.Api.Services
Assembly
Virtufin.Api.dll
public class PubsubSubscriptionManager : SubscriptionManagerBase<SubscribeResponse, PubsubSubscription>
Inheritance
PubsubSubscriptionManager
Inherited Members

Constructors

PubsubSubscriptionManager(ILogger<PubsubSubscriptionManager>)

public PubsubSubscriptionManager(ILogger<PubsubSubscriptionManager> logger)

Parameters

logger ILogger<PubsubSubscriptionManager>

Methods

BroadcastToTopicAsync(string, SubscribeResponse)

public Task BroadcastToTopicAsync(string topic, SubscribeResponse response)

Parameters

topic string
response SubscribeResponse

Returns

Task

GetAllSubscriptions()

public IEnumerable<KeyValuePair<string, ConcurrentDictionary<string, PubsubSubscription>>> GetAllSubscriptions()

Returns

IEnumerable<KeyValuePair<string, ConcurrentDictionary<string, PubsubSubscription>>>

GetSubscriptionKey(PubsubSubscription)

Gets the subscription key for a subscription.

protected override string GetSubscriptionKey(PubsubSubscription subscription)

Parameters

subscription PubsubSubscription

The subscription to get the key for.

Returns

string

The subscription key string.

SendEventAsync(PubsubSubscription, SubscribeResponse, CancellationToken)

Sends an event to a subscription.

protected override Task SendEventAsync(PubsubSubscription subscription, SubscribeResponse evt, CancellationToken cancellationToken)

Parameters

subscription PubsubSubscription

The subscription to send to.

evt SubscribeResponse

The event to send.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

Subscribe(string, ChannelWriter<SubscribeResponse>)

public string Subscribe(string topic, ChannelWriter<SubscribeResponse> writer)

Parameters

topic string
writer ChannelWriter<SubscribeResponse>

Returns

string

UnsubscribeById(string)

Removes a subscriber by id. Returns true if a subscriber was found and removed, false if the id matched nothing -- callers need to be able to tell those apart, otherwise Unsubscribe reports success for any string.

public bool UnsubscribeById(string subscriptionId)

Parameters

subscriptionId string

Returns

bool