Esempio n. 1
0
        public async Task ShouldSubscribeAndPublishToTradeEventTopics()
        {
            // Join the cluster
            Within(TimeSpan.FromSeconds(5), () =>
            {
                Cluster.Cluster.Get(Sys).Join(SelfAddress);
                AwaitCondition(
                    () => Cluster.Cluster.Get(Sys).State.Members.Count(x => x.Status == MemberStatus.Up) == 1);
            });

            // Start DistributedPubSub
            var subManager = DistributedPubSubTradeEventSubscriptionManager.For(Sys);
            var published  = DistributedPubSubTradeEventPublisher.For(Sys);

            // Subscribe to all topics
            var subAck = await subManager.Subscribe("MSFT", TestActor);

            subAck.StockId.Should().Be("MSFT");

            var bid = new Bid("MSFT", "foo", 10.0m, 1.0d, DateTimeOffset.UtcNow);

            published.Publish("MSFT", bid);
            ExpectMsg <Bid>();
        }
Esempio n. 2
0
 public OrderBookActor(string tickerSymbol, IActorRef confirmationActor) : this(tickerSymbol, null, DistributedPubSubTradeEventPublisher.For(Context.System), NoOpTradeEventSubscriptionManager.Instance, confirmationActor)
 {
 }
Esempio n. 3
0
 public OrderBookActor(string tickerSymbol) : this(tickerSymbol, null, DistributedPubSubTradeEventPublisher.For(Context.System), NoOpTradeEventSubscriptionManager.Instance, Context.Parent)
 {
 }