Beispiel #1
0
        private IMessagePublisher GetSimpleMessagePublisher(ServiceBusPublisherConfiguration config)
        {
            var simpleTopicClient = _topicClientCreator.CreateTopicClient(config.PrimaryConfiguration,
                                                                          _statsDClient);
            var resolver = new SimplePublisherClientResolver(simpleTopicClient);

            return(new MessagePublisher(resolver));
        }
Beispiel #2
0
        private IMessagePublisher GetFailoverMessagePublisher(ServiceBusPublisherConfiguration config)
        {
            var primaryTopicClient = _topicClientCreator.CreateTopicClient(config.PrimaryConfiguration,
                                                                           _statsDClient);

            var failoverTopicClient = _topicClientCreator.CreateTopicClient(config.FailOverConfiguration,
                                                                            _statsDClient);

            var failoverPublisher = new FailoverPublisherClientResolver(
                primaryTopicClient,
                failoverTopicClient,
                _statsDClient);

            return(new MessagePublisher(failoverPublisher));
        }
Beispiel #3
0
        public IMessagePublisher CreatePublisher(ServiceBusPublisherConfiguration config)
        {
            IMessagePublisher publisher;

            switch (config.ServiceBusPublisherStrategy)
            {
            case ServiceBusPublisherStrategy.Simple:
                publisher = GetSimpleMessagePublisher(config);
                break;

            case ServiceBusPublisherStrategy.FailOverEnable:
                publisher = GetFailoverMessagePublisher(config);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(publisher);
        }