Exemplo 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>();
        }
Exemplo n.º 2
0
 public MatchAggregator(string tickerSymbol) : this(tickerSymbol, DistributedPubSubTradeEventSubscriptionManager.For(Context.System),
                                                    DistributedPubSubMarketEventSubscriptionManager.For(Context.System), DistributedPubSubMarketEventPublisher.For(Context.System))
 {
 }
 public AskerActor(string tickerSymbol, PriceRange targetRange, IActorRef tradeGateway)
     : this(tickerSymbol, DistributedPubSubTradeEventSubscriptionManager.For(Context.System), tradeGateway, targetRange,
            GuidTradeOrderIdGenerator.Instance, CurrentUtcTimestamper.Instance)
 {
 }