InMemorySubscriptionStorage(InMemorySubscriberStore subscriberStore, bool isCentralized) { if (subscriberStore == null) { throw new ArgumentNullException(nameof(subscriberStore)); } _subscriberStore = subscriberStore; IsCentralized = isCentralized; }
/// <summary> /// Creates the in-mem subscription storage as a centralized subscription storage, using the given /// <see cref="InMemorySubscriberStore"/> to share subscriptions /// </summary> public InMemorySubscriptionStorage(InMemorySubscriberStore subscriberStore) { if (subscriberStore == null) { throw new ArgumentNullException(nameof(subscriberStore)); } _subscriberStore = subscriberStore; IsCentralized = true; }
protected override void SetUp() { _network = new InMemNetwork(); _subscriberStore = new InMemorySubscriberStore(); _activator = new BuiltinHandlerActivator(); Using(_activator); Configure.With(_activator) .Transport(t => t.UseInMemoryTransport(_network, "endpoint1")) .Subscriptions(s => s.StoreInMemory(_subscriberStore)) .Start(); }
protected override void SetUp() { var network = new InMemNetwork(); var subscriberStore = new InMemorySubscriberStore(); _publisher = GetEndpoint(network, "publisher", c => { c.Subscriptions(s => s.StoreInMemory(subscriberStore)); c.Routing(r => r.TypeBased()); }); _client1GotTheEvent = new ManualResetEvent(false); _client1 = GetEndpoint(network, "client1", c => { c.Routing(r => r.TypeBased().Map<SomeKindOfEvent>("publisher")); }); _client1.Handle<SomeKindOfEvent>(async e => _client1GotTheEvent.Set()); }
/// <summary> /// Configures Rebus to store subscriptions in memory. The subscription storage is assumed to be CENTRALIZED /// with this overload because a <see cref="InMemorySubscriberStore"/> is passed in. PLEASE NOTE that this /// is probably not useful for any other scenario than TESTING because usually you want subscriptions to be PERSISTENT. /// </summary> public static void StoreInMemory(this StandardConfigurer<ISubscriptionStorage> configurer, InMemorySubscriberStore inMemorySubscriberStore) { if (inMemorySubscriberStore == null) throw new ArgumentNullException(nameof(inMemorySubscriberStore)); configurer.Register(c => new InMemorySubscriptionStorage(inMemorySubscriberStore)); }
/// <summary> /// Creates the in-mem subscription storage as a centralized subscription storage, using the given /// <see cref="InMemorySubscriberStore"/> to share subscriptions /// </summary> public InMemorySubscriptionStorage(InMemorySubscriberStore subscriberStore) : this(subscriberStore, true) { }
/// <summary> /// Configures Rebus to store subscriptions in memory. The subscription storage is assumed to be CENTRALIZED /// with this overload because a <see cref="InMemorySubscriberStore"/> is passed in. PLEASE NOTE that this /// is probably not useful for any other scenario than TESTING because usually you want subscriptions to be PERSISTENT. /// </summary> public static void StoreInMemory(this StandardConfigurer <ISubscriptionStorage> configurer, InMemorySubscriberStore inMemorySubscriberStore) { if (inMemorySubscriberStore == null) { throw new ArgumentNullException(nameof(inMemorySubscriberStore)); } configurer.Register(c => new InMemorySubscriptionStorage(inMemorySubscriberStore)); }
/// <summary> /// Creates the in-mem subscription storage as a decentralized subscription storage with its /// own private subscriber store /// </summary> public InMemorySubscriptionStorage() { _subscriberStore = new InMemorySubscriberStore(); IsCentralized = false; }
/// <summary> /// Creates the in-mem subscription storage as a centralized subscription storage, using the given /// <see cref="InMemorySubscriberStore"/> to share subscriptions /// </summary> public InMemorySubscriptionStorage(InMemorySubscriberStore subscriberStore) { if (subscriberStore == null) throw new ArgumentNullException(nameof(subscriberStore)); _subscriberStore = subscriberStore; IsCentralized = true; }