public void Subscribe(string topic, Action <TransportFileDelivery> callback) { if (string.IsNullOrEmpty(topic)) { throw new ArgumentException("Topic must not be empty", nameof(topic)); } if (callback == null) { throw new ArgumentNullException(nameof(callback)); } // Console.WriteLineConsole.WriteLine($"^^^ FILERECEIVER subscribe to {topic}"); var subscription = _messaging.Subscribe(topic, message => { // Console.WriteLine($"^^^ FILERECEIVER receive file on topic: {topic}"); HandleMessage(callback, message); }); _subscriptions.Add(topic, subscription); }
public void Subscribe(string[] patterns, Action <Message> handler) { _subscriptionHandles = patterns.Select(p => _messaging.Subscribe(p, handler)).ToArray(); }