示例#1
0
        public OrleansMessageBus(IDependencyResolver resolver, ScaleoutConfiguration configuration)
            : base(resolver, configuration)
        {
            grain = PubSubGrainFactory.GetGrain(Guid.NewGuid());

            subscriber = new MessageObserver((messages) =>
            {
                lock (grain)
                {
                    OnReceived(messages[0].StreamIndex, messages.Select(x => x.MappingId).Max(), new ScaleoutMessage(messages));
                }
            });
            subscriberReference = MessageObserverFactory.CreateObjectReference(subscriber).Result;
            grain.Subscribe(subscriberReference).Wait();
        }
示例#2
0
        public OrleansMessageBus(IDependencyResolver resolver, ScaleoutConfiguration configuration)
            : base(resolver, configuration)
        {
            grain = PubSubGrainFactory.GetGrain(Guid.NewGuid());

            subscriber = new MessageObserver((messages) =>
            {
                lock (grain)
                {
                    OnReceived(messages[0].StreamIndex, messages.Select(x => x.MappingId).Max(), new ScaleoutMessage(messages));
                }
            });
            subscriberReference = MessageObserverFactory.CreateObjectReference(subscriber).Result;
            grain.Subscribe(subscriberReference).Wait();
        }