public InMemoryConsumer Subscribe(string topic) { var consumer = new InMemoryConsumer(); if (!clientDic.TryGetValue(topic, out var clients)) { clientDic.TryAdd(topic, new SubscribeRecord() { Topic = topic, Clients = new List <InMemoryConsumer>() { consumer } }); } else { clients.Clients.Add(consumer); } return(consumer); }
public Task SubscribeAsync(MessageExchangeOptions options, CancellationToken cancellationToken = default) { _currentConsumer = _queue.Subscribe(options.Topic); subscribeTopic = options.Topic; return(Task.CompletedTask); }