コード例 #1
0
        public static EventChannel AddChannel(IEventChannelService channelService, int timeout = 30)
        {
            EventChannel channel;

            //Act
            var executionGetResult = channelService.GetChannelAsync(x => x.Name == "TestChannel").Result;

            executionGetResult.Should().NotBeNull();
            executionGetResult.IsSuccessful.Should().BeTrue();

            if (executionGetResult.Result == null)
            {
                var executionResult = channelService.RegisterChannelAsync(new EventChannel
                {
                    IsFifo                = true,
                    Key                   = Guid.NewGuid().ToString(),
                    Name                  = "TestChannel",
                    MaxLifeTimeMessage    = timeout,
                    MaxLifeTimeSubscriber = timeout
                }).Result;

                executionResult.Should().NotBeNull();
                executionResult.IsSuccessful.Should().BeTrue();

                channel = executionResult.Result;
            }
            else
            {
                channel = executionGetResult.Result;
            }

            channel.Should().NotBeNull();

            return(channel);
        }
コード例 #2
0
        public EventLiveStreamerService(IEventChannelRepository eventChannelRepository,
                                        IEventSubscriptionRepository eventSubscriptionRepository,
                                        IEventRepository eventMessageRepository, ILoggerFactory loggerFactory,
                                        DiagnosticSource diagnosticSource)
        {
            _diagnosticSource         = diagnosticSource;
            _eventChannelRepository   = new EventChannelService(eventChannelRepository);
            _eventSubscriptionService = new EventSubscriptionService(eventSubscriptionRepository);
            _eventMessageService      = new EventMessageService(eventMessageRepository);

            _logger = loggerFactory.CreateLogger <EventLiveStreamerService>();
        }