コード例 #1
0
 private LinkConsumerBuilder(
     LinkConsumerBuilder prev,
     TimeSpan?recoveryInterval = null,
     ushort?prefetchCount      = null,
     bool?autoAck            = null,
     int?priority            = null,
     bool?cancelOnHaFailover = null,
     bool?exclusive          = null,
     ILinkConsumerErrorStrategy errorStrategy = null,
     LinkConsumerMessageHandlerBuilder messageHandlerBuilder = null,
     ILinkConsumerTopologyHandler topologyHandler            = null,
     LinkStateHandler <LinkConsumerState> stateHandler       = null,
     LinkStateHandler <LinkChannelState> channelStateHandler = null,
     ILinkSerializer serializer          = null,
     LinkTypeNameMapping typeNameMapping = null
     ) : this
     (
         prev._link,
         recoveryInterval ?? prev._reconveryInterval,
         serializer ?? prev._serializer,
         prefetchCount ?? prev._prefetchCount,
         autoAck ?? prev._autoAck,
         priority ?? prev._priority,
         cancelOnHaFailover ?? prev._cancelOnHaFailover,
         exclusive ?? prev._exclusive,
         errorStrategy ?? prev._errorStrategy,
         messageHandlerBuilder ?? prev._messageHandlerBuilder,
         topologyHandler ?? prev._topologyHandler,
         stateHandler ?? prev._stateHandler,
         channelStateHandler ?? prev._channelStateHandler,
         typeNameMapping ?? prev._typeNameMapping
     )
 {
 }
コード例 #2
0
        public LinkConsumerBuilder(
            Link link,
            TimeSpan recoveryInterval,
            ILinkSerializer serializer,
            ushort?prefetchCount    = null,
            bool?autoAck            = null,
            int?priority            = null,
            bool?cancelOnHaFailover = null,
            bool?exclusive          = null,
            ILinkConsumerErrorStrategy errorStrategy = null,
            LinkConsumerMessageHandlerBuilder messageHandlerBuilder = null,
            ILinkConsumerTopologyHandler topologyHandler            = null,
            LinkStateHandler <LinkConsumerState> stateHandler       = null,
            LinkStateHandler <LinkChannelState> channelStateHandler = null,
            LinkTypeNameMapping typeNameMapping = null
            )
        {
            _link = link ?? throw new ArgumentNullException(nameof(link));

            _reconveryInterval     = recoveryInterval;
            _prefetchCount         = prefetchCount ?? 1;
            _autoAck               = autoAck ?? false;
            _priority              = priority ?? 0;
            _cancelOnHaFailover    = cancelOnHaFailover ?? false;
            _exclusive             = exclusive ?? false;
            _errorStrategy         = errorStrategy ?? new LinkConsumerDefaultErrorStrategy();
            _messageHandlerBuilder = messageHandlerBuilder;
            _topologyHandler       = topologyHandler;
            _stateHandler          = stateHandler ?? ((old, @new) => { });
            _channelStateHandler   = channelStateHandler ?? ((old, @new) => { });
            _serializer            = serializer;
            _typeNameMapping       = typeNameMapping ?? new LinkTypeNameMapping();
        }
コード例 #3
0
        public LinkConsumerConfiguration(
            TimeSpan recoveryInterval,
            ushort prefetchCount,
            bool autoAck,
            int priority,
            bool cancelOnHaFailover,
            bool exclusive,
            ILinkConsumerTopologyHandler topologyHandler,
            LinkStateHandler<LinkConsumerState> stateHandler,
            ILinkConsumerErrorStrategy errorStrategy,
            LinkConsumerMessageHandlerDelegate<byte[]> messageHandler,
            ILinkSerializer serializer
        )
        {
            if (recoveryInterval < TimeSpan.Zero)
                throw new ArgumentOutOfRangeException(nameof(recoveryInterval), "Must be greater than TimeSpan.Zero");
            
            if(prefetchCount == 0)
                throw new ArgumentOutOfRangeException(nameof(prefetchCount), "Must be greater than 0");

            RecoveryInterval = recoveryInterval;
            PrefetchCount = prefetchCount;
            AutoAck = autoAck;
            Priority = priority;
            CancelOnHaFailover = cancelOnHaFailover;
            Exclusive = exclusive;
            MessageHandler = messageHandler ?? throw new ArgumentNullException(nameof(messageHandler));
            ErrorStrategy = errorStrategy ?? throw new ArgumentNullException(nameof(errorStrategy));
            TopologyHandler = topologyHandler ?? throw new ArgumentNullException(nameof(topologyHandler));
            StateHandler = stateHandler ?? throw new ArgumentNullException(nameof(stateHandler));
            Serializer = serializer;
        }
コード例 #4
0
        public ILinkConsumerBuilder Queue(ILinkConsumerTopologyHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            return(new LinkConsumerBuilder(this, topologyHandler: handler));
        }
コード例 #5
0
 public ILinkPullConsumerBuilder Queue(ILinkConsumerTopologyHandler handler)
 {
     return(new LinkPullConsumerBuilder(this, consumerBuilder: _consumerBuilder.Queue(handler)));
 }