public Subscriber(IEnumerable <string> baseAddress, ushort publisherPort, ushort snapshotPort, IDictionary <Type, TypeConfig> knownTypes, IDictionary <string, Type> topics, ILastValueCache lastValueCache) { _knownTypes = knownTypes; _topics = topics; _lastValueCache = lastValueCache; _publisherPort = publisherPort; _snapshotPort = snapshotPort; _client = new ReliableClient(baseAddress.Select(x => $"{x}:{publisherPort}"), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(5), HandleUpdate, (x, m) => Debug.WriteLine($"Error in message handler. Exception {x} Message {m}"), GetSnapshots); foreach (var topic in _topics.Keys) { _client.Subscribe(topic); } }
public Subscriber(IEnumerable <string> baseAddress, ushort publisherPort, ushort snapshotPort, IDictionary <Type, TypeConfig> knownTypes, IDictionary <string, Type> topics, ILastValueCache lastValueCache) { _knownTypes = knownTypes; _topics = topics; _lastValueCache = lastValueCache; _publisherPort = publisherPort; _snapshotPort = snapshotPort; var addresses = baseAddress.Select(x => $"{x}:{publisherPort}"); _client = new ReliableClient(addresses: addresses, heartbeatTimeOut: TimeSpan.FromSeconds(2), reconnectInterval: TimeSpan.FromSeconds(2), subscriberMessageHandler: HandleUpdate, subscriberErrorHandler: HandleError, welcomeMessageHandler: GetSnapshots); foreach (var topic in _topics.Keys) { _client.Subscribe(topic); } }