public AddOrReplacePublishers ( string sourceKey, IList |
||
sourceKey | string | Key for this registration source. |
entries | IList |
Entries. |
Résultat | void |
public void AddOrReplacePublishers(string sourceKey, IList<PublisherTableEntry> entries)
{
lock (updateLock)
{
publisherRegistrations[sourceKey] = entries;
var newRouteTable = new Dictionary<Type, HashSet<PublisherAddress>>();
foreach (var entry in publisherRegistrations.Values.SelectMany(g => g))
{
HashSet<PublisherAddress> publishersOfThisEvent;
if (!newRouteTable.TryGetValue(entry.EventType, out publishersOfThisEvent))
{
publishersOfThisEvent = new HashSet<PublisherAddress>();
newRouteTable[entry.EventType] = publishersOfThisEvent;
}
publishersOfThisEvent.Add(entry.Address);
}
publishers = newRouteTable;
}
}
public void SetUp() { var publishers = new Publishers(); publishers.AddOrReplacePublishers("A", new List<PublisherTableEntry> {new PublisherTableEntry(typeof(object), PublisherAddress.CreateFromPhysicalAddresses("publisher1"))}); router = new SubscriptionRouter(publishers, new EndpointInstances(), i => i.ToString()); dispatcher = new FakeDispatcher(); subscribeTerminator = new MessageDrivenSubscribeTerminator(router, "replyToAddress", "Endpoint", dispatcher); }