public LinkPullConsumer( ILinkConsumerBuilder consumerBuilder, TimeSpan getMessageTimeout, LinkTypeNameMapping typeNameMapping, ILinkSerializer serializer ) { if (consumerBuilder == null) { throw new ArgumentNullException(nameof(consumerBuilder)); } if (getMessageTimeout < TimeSpan.Zero && getMessageTimeout != Timeout.InfiniteTimeSpan) { throw new ArgumentOutOfRangeException(nameof(getMessageTimeout), "Must be greater or equal zero or equal Timeout.InfiniteTimeSpan"); } GetMessageTimeout = getMessageTimeout; _typeNameMapping = typeNameMapping ?? throw new ArgumentNullException(nameof(typeNameMapping)); _serializer = serializer; _consumer = consumerBuilder .ErrorStrategy(new LinkConsumerDefaultErrorStrategy()) .Handler(OnMessageReceived) .OnStateChange(OnStateChanged) .Build(); }
public RpcConsumer(ServiceLink link, ILinkConsumerBuilder builder, string queueName) { QueueName = queueName; _link = link; _consumer = builder.Handler(Handle).Build(); }