Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="isDurable">The durability of the queue.</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 public Connection(
     Type dataType,
     ConnectionName name            = null,
     ChannelName channelName        = null,
     RoutingKey routingKey          = null,
     int noOfPerformers             = 1,
     int timeoutInMilliseconds      = 300,
     int requeueCount               = -1,
     int requeueDelayInMilliseconds = 0,
     int unacceptableMessageLimit   = 0,
     bool isDurable = false,
     bool isAsync   = false,
     IAmAChannelFactory channelFactory = null)
 {
     DataType                   = dataType;
     Name                       = name ?? new ConnectionName(dataType.FullName);
     ChannelName                = channelName ?? new ChannelName(dataType.FullName);
     RoutingKey                 = routingKey ?? new RoutingKey(dataType.FullName);
     NoOfPeformers              = noOfPerformers;
     TimeoutInMiliseconds       = timeoutInMilliseconds;
     RequeueCount               = requeueCount;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     UnacceptableMessageLimit   = unacceptableMessageLimit;
     IsDurable                  = isDurable;
     IsAsync                    = isAsync;
     ChannelFactory             = channelFactory;
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
        /// Use this constructor when both rpc support is required
        /// </summary>
        /// <param name="subscriberRegistry">The subscriber registry.</param>
        /// <param name="handlerFactory">The handler factory.</param>
        /// <param name="requestContextFactory">The request context factory.</param>
        /// <param name="policyRegistry">The policy registry.</param>
        /// <param name="mapperRegistry">The mapper registry.</param>
        /// <param name="outBox">The outbox</param>
        /// <param name="producerRegistry">The register of producers via whom we send messages over the external bus</param>
        /// <param name="replySubscriptions">The Subscriptions for creating the reply queues</param>
        /// <param name="responseChannelFactory">If we are expecting a response, then we need a channel to listen on</param>
        /// <param name="outboxTimeout">How long should we wait to write to the outbox</param>
        /// <param name="featureSwitchRegistry">The feature switch config provider.</param>
        /// <param name="inboxConfiguration">Do we want to insert an inbox handler into pipelines without the attribute. Null (default = no), yes = how to configure</param>
        /// <param name="boxTransactionConnectionProvider">The Box Connection Provider to use when Depositing into the outbox.</param>
        public CommandProcessor(
            IAmASubscriberRegistry subscriberRegistry,
            IAmAHandlerFactory handlerFactory,
            IAmARequestContextFactory requestContextFactory,
            IPolicyRegistry <string> policyRegistry,
            IAmAMessageMapperRegistry mapperRegistry,
            IAmAnOutbox <Message> outBox,
            IAmAProducerRegistry producerRegistry,
            IEnumerable <Subscription> replySubscriptions,
            int outboxTimeout = 300,
            IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
            IAmAChannelFactory responseChannelFactory       = null,
            InboxConfiguration inboxConfiguration           = null,
            IAmABoxTransactionConnectionProvider boxTransactionConnectionProvider = null)
            : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
        {
            _mapperRegistry                   = mapperRegistry;
            _featureSwitchRegistry            = featureSwitchRegistry;
            _responseChannelFactory           = responseChannelFactory;
            _inboxConfiguration               = inboxConfiguration;
            _boxTransactionConnectionProvider = boxTransactionConnectionProvider;
            _replySubscriptions               = replySubscriptions;

            InitExtServiceBus(policyRegistry, outBox, outboxTimeout, producerRegistry);

            ConfigureCallbacks(producerRegistry);
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="runAsync">Is this channel read asynchronously</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 public Subscription(
     Type dataType,
     SubscriptionName name          = null,
     ChannelName channelName        = null,
     RoutingKey routingKey          = null,
     int bufferSize                 = 1,
     int noOfPerformers             = 1,
     int timeoutInMilliseconds      = 300,
     int requeueCount               = -1,
     int requeueDelayInMilliseconds = 0,
     int unacceptableMessageLimit   = 0,
     bool runAsync = false,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create)
 {
     DataType                   = dataType;
     Name                       = name ?? new SubscriptionName(dataType.FullName);
     ChannelName                = channelName ?? new ChannelName(dataType.FullName);
     RoutingKey                 = routingKey ?? new RoutingKey(dataType.FullName);
     BufferSize                 = bufferSize;
     NoOfPeformers              = noOfPerformers;
     TimeoutInMiliseconds       = timeoutInMilliseconds;
     RequeueCount               = requeueCount;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     UnacceptableMessageLimit   = unacceptableMessageLimit;
     RunAsync                   = runAsync;
     ChannelFactory             = channelFactory;
     MakeChannels               = makeChannels;
 }
        public MsSqlMessageConsumerRequeueTests()
        {
            var myCommand = new MyCommand {
                Value = "Test"
            };
            Guid   correlationId = Guid.NewGuid();
            string replyTo       = "http:\\queueUrl";
            string contentType   = "text\\plain";
            var    channelName   = $"Consumer-Requeue-Tests-{Guid.NewGuid()}";
            string topicName     = $"Consumer-Requeue-Tests-{Guid.NewGuid()}";

            _message = new Message(
                new MessageHeader(myCommand.Id, topicName, MessageType.MT_COMMAND, correlationId, replyTo, contentType),
                new MessageBody(JsonSerializer.Serialize(myCommand, JsonSerialisationOptions.Options))
                );

            var testHelper = new MsSqlTestHelper();

            testHelper.SetupQueueDb();

            _subscription = new MsSqlSubscription <MyCommand>(new SubscriptionName(channelName),
                                                              new ChannelName(topicName), new RoutingKey(topicName));
            _producer       = new MsSqlMessageProducerFactory(testHelper.QueueConfiguration).Create();
            _channelFactory = new ChannelFactory(new MsSqlMessageConsumerFactory(testHelper.QueueConfiguration));
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="runAsync">Is this channel read asynchronously</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="lockTimeout">What is the visibility timeout for the queue</param>
 /// <param name="delaySeconds">The length of time, in seconds, for which the delivery of all messages in the queue is delayed.</param>
 /// <param name="messageRetentionPeriod">The length of time, in seconds, for which Amazon SQS retains a message</param>
 /// <param name="findTopicBy">Is the Topic an Arn, should be treated as an Arn by convention, or a name</param>
 /// <param name="iAmPolicy">The queue's policy. A valid AWS policy.</param>
 /// <param name="redrivePolicy">The policy that controls when and where requeued messages are sent to the DLQ</param>
 /// <param name="snsAttributes">The attributes of the Topic, either ARN if created, or attributes for creation</param>
 /// <param name="tags">Resource tags to be added to the queue</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 public SqsSubscription(Type dataType,
                        SubscriptionName name          = null,
                        ChannelName channelName        = null,
                        RoutingKey routingKey          = null,
                        int bufferSize                 = 1,
                        int noOfPerformers             = 1,
                        int timeoutInMilliseconds      = 300,
                        int requeueCount               = -1,
                        int requeueDelayInMilliseconds = 0,
                        int unacceptableMessageLimit   = 0,
                        bool runAsync = false,
                        IAmAChannelFactory channelFactory = null,
                        int lockTimeout                  = 10,
                        int delaySeconds                 = 0,
                        int messageRetentionPeriod       = 345600,
                        TopicFindBy findTopicBy          = TopicFindBy.Name,
                        string iAmPolicy                 = null,
                        RedrivePolicy redrivePolicy      = null,
                        SnsAttributes snsAttributes      = null,
                        Dictionary <string, string> tags = null,
                        OnMissingChannel makeChannels    = OnMissingChannel.Create
                        )
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMilliseconds,
            unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
 {
     LockTimeout            = lockTimeout;
     DelaySeconds           = delaySeconds;
     MessageRetentionPeriod = messageRetentionPeriod;
     FindTopicBy            = findTopicBy;
     IAMPolicy     = iAmPolicy;
     RedrivePolicy = redrivePolicy;
     SnsAttributes = snsAttributes;
     Tags          = tags;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="isDurable">The durability of the queue definition in the broker.</param>
 /// <param name="runAsync">Is this channel read asynchronously</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="highAvailability">Should we mirror the queue over multiple nodes</param>
 /// <param name="lockTimeout">How long should a message remain locked for processing</param>
 /// <param name="deadLetterChannelName">The dead letter channel </param>
 /// <param name="deadLetterRoutingKey">The routing key for dead letters</param>
 /// <param name="ttl">Time to live in ms of a message on a queue; null (the default) is inifinite</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 public RmqSubscription(
     Type dataType,
     SubscriptionName name          = null,
     ChannelName channelName        = null,
     RoutingKey routingKey          = null,
     int bufferSize                 = 1,
     int noOfPerformers             = 1,
     int timeoutInMilliseconds      = 300,
     int requeueCount               = -1,
     int requeueDelayInMilliseconds = 0,
     int unacceptableMessageLimit   = 0,
     bool isDurable                 = false,
     bool runAsync = false,
     IAmAChannelFactory channelFactory = null,
     bool highAvailability             = false,
     ChannelName deadLetterChannelName = null,
     string deadLetterRoutingKey       = null,
     int?ttl = null,
     OnMissingChannel makeChannels = OnMissingChannel.Create)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
 {
     DeadLetterRoutingKey  = deadLetterRoutingKey;
     DeadLetterChannelName = deadLetterChannelName;
     HighAvailability      = highAvailability;
     IsDurable             = isDurable;
     TTL = ttl;
 }
Example #7
0
        /// <summary>
        /// The <see cref="CommandProcessor"/> wants to support <see cref="CommandProcessor.Call{T}(T)"/> using RPC between client and server
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="outbox">The outbox</param>
        /// <param name="subscriptions">Subscriptions for creating reply queues</param>
        /// <returns></returns>
        public INeedARequestContext ExternalRPC(ExternalBusConfiguration configuration, IAmAnOutbox <Message> outbox, IEnumerable <Subscription> subscriptions)
        {
            _useRequestReplyQueues  = true;
            _replySubscriptions     = subscriptions;
            _producers              = configuration.ProducerRegistry;
            _messageMapperRegistry  = configuration.MessageMapperRegistry;
            _outboxWriteTimeout     = configuration.OutboxWriteTimeout;
            _responseChannelFactory = configuration.ResponseChannelFactory;
            _outbox = outbox;

            return(this);
        }
Example #8
0
        /// <summary>
        /// The <see cref="CommandProcessor"/> wants to support <see cref="CommandProcessor.Call{T}(T)"/> using RPC between client and server
        /// </summary>
        /// <param name="messagingConfiguration"></param>
        /// <returns></returns>
        public INeedARequestContext RequestReplyQueues(MessagingConfiguration configuration)
        {
            _useRequestReplyQueues       = true;
            _messagingGateway            = configuration.MessageProducer;
            _asyncMessagingGateway       = configuration.MessageProducerAsync;
            _messageMapperRegistry       = configuration.MessageMapperRegistry;
            _outboxWriteTimeout          = configuration.OutboxWriteTimeout;
            _messagingGatewaySendTimeout = configuration.MessagingGatewaySendTimeout;
            _responseChannelFactory      = configuration.ResponseChannelFactory;

            return(this);
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExternalBusConfiguration"/> class.
 /// </summary>
 /// <param name="producerRegistry">Clients for the external bus by topic they send to. The client details are specialised by transport</param>
 /// <param name="messageMapperRegistry">The message mapper registry.</param>
 /// <param name="outboxWriteTimeout">How long to wait when writing to the outbox</param>
 /// <param name="responseChannelFactory">in a request-response scenario how do we build response pipelie</param>
 /// <param name="useInbox">Do we want to create an inbox globally i.e. on every handler (as opposed to by hand). Defaults to null, ,by hand</param>
 public ExternalBusConfiguration(
     IAmAProducerRegistry producerRegistry,
     IAmAMessageMapperRegistry messageMapperRegistry,
     int outboxWriteTimeout = 300,
     IAmAChannelFactory responseChannelFactory = null,
     InboxConfiguration useInbox = null
     )
 {
     ProducerRegistry       = producerRegistry;
     MessageMapperRegistry  = messageMapperRegistry;
     OutboxWriteTimeout     = outboxWriteTimeout;
     ResponseChannelFactory = responseChannelFactory;
     UseInbox = useInbox;
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer</param>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="routingKey">The routing key</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel</param>
 /// <param name="channelName">The channel name</param>
 /// <param name="isDurable">The durability of the queue</param>
 public Connection(ConnectionName name, IAmAChannelFactory channelFactory, Type dataType, ChannelName channelName, string routingKey, int noOfPerformers = 1, int timeoutInMilliseconds = 300, int requeueCount = -1, int requeueDelayInMilliseconds = 0, int unacceptableMessageLimit = 0, bool isDurable = false)
 {
     RequeueCount               = requeueCount;
     Name                       = name;
     ChannelFactory             = channelFactory;
     DataType                   = dataType;
     NoOfPeformers              = noOfPerformers;
     TimeoutInMiliseconds       = timeoutInMilliseconds;
     UnacceptableMessageLimit   = unacceptableMessageLimit;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     ChannelName                = channelName;
     RoutingKey                 = routingKey;
     IsDurable                  = isDurable;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessagingConfiguration"/> class.
 /// </summary>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="messageMapperRegistry">The message mapper registry.</param>
 /// <param name="messageStoreWriteTimeout">How long to wait when writing to the message store</param>
 /// <param name="messagingGatewaySendTimeout">How long to wait when sending via the gateway</param>
 public MessagingConfiguration(
     IAmAMessageStore <Message> messageStore,
     IAmAMessageProducer messageProducer,
     IAmAMessageMapperRegistry messageMapperRegistry,
     int messageStoreWriteTimeout              = 300,
     int messagingGatewaySendTimeout           = 300,
     IAmAChannelFactory responseChannelFactory = null
     )
 {
     MessageStore                = messageStore;
     MessageProducer             = messageProducer;
     MessageMapperRegistry       = messageMapperRegistry;
     MessageStoreWriteTimeout    = messageStoreWriteTimeout;
     MessagingGatewaySendTimeout = messagingGatewaySendTimeout;
     ResponseChannelFactory      = responseChannelFactory;
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessagingConfiguration"/> class.
 /// </summary>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="messageMapperRegistry">The message mapper registry.</param>
 /// <param name="outboxWriteTimeout">How long to wait when writing to the outbox</param>
 /// <param name="messagingGatewaySendTimeout">How long to wait when sending via the gateway</param>
 /// <param name="responseChannelFactory">in a request-response scenario how do we build response pipelie</param>
 /// <param name="useInbox">Do we want to create an inbox globally i.e. on every handler (as opposed to by hand). Defaults to null, ,by hand</param>
 public MessagingConfiguration(
     IAmAMessageProducer messageProducer,
     IAmAMessageMapperRegistry messageMapperRegistry,
     int outboxWriteTimeout                    = 300,
     int messagingGatewaySendTimeout           = 300,
     IAmAChannelFactory responseChannelFactory = null,
     InboxConfiguration useInbox               = null
     )
 {
     MessageProducer             = messageProducer;
     MessageMapperRegistry       = messageMapperRegistry;
     OutboxWriteTimeout          = outboxWriteTimeout;
     MessagingGatewaySendTimeout = messagingGatewaySendTimeout;
     ResponseChannelFactory      = responseChannelFactory;
     UseInbox = useInbox;
 }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both rpc and command processor support is required
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="messageStore">The message store.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="responseChannelFactory">If we are expecting a response, then we need a channel to listen on</param>
 /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param>
 /// <param name="featureSwitchRegistry">The feature switch config provider.</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IAmAPolicyRegistry policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageProducer messageProducer,
     int messageStoreTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
     IAmAChannelFactory responseChannelFactory       = null)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
 {
     _mapperRegistry         = mapperRegistry;
     _messageProducer        = messageProducer;
     _messageStoreTimeout    = messageStoreTimeout;
     _featureSwitchRegistry  = featureSwitchRegistry;
     _responseChannelFactory = responseChannelFactory;
 }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="runAsync">Is this channel read asynchronously</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 public MsSqlSubscription(
     Type dataType,
     SubscriptionName name          = null,
     ChannelName channelName        = null,
     RoutingKey routingKey          = null,
     int bufferSize                 = 1,
     int noOfPerformers             = 1,
     int timeoutInMilliseconds      = 300,
     int requeueCount               = -1,
     int requeueDelayInMilliseconds = 0,
     int unacceptableMessageLimit   = 0,
     bool runAsync = false,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
            requeueDelayInMilliseconds, unacceptableMessageLimit, runAsync, channelFactory, makeChannels)
 {
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandProcessor"/> class.
 /// Use this constructor when both rpc and command processor support is required
 /// </summary>
 /// <param name="subscriberRegistry">The subscriber registry.</param>
 /// <param name="handlerFactory">The handler factory.</param>
 /// <param name="requestContextFactory">The request context factory.</param>
 /// <param name="policyRegistry">The policy registry.</param>
 /// <param name="mapperRegistry">The mapper registry.</param>
 /// <param name="messageProducer">The messaging gateway.</param>
 /// <param name="responseChannelFactory">If we are expecting a response, then we need a channel to listen on</param>
 /// <param name="outboxTimeout">How long should we wait to write to the outbox</param>
 /// <param name="featureSwitchRegistry">The feature switch config provider.</param>
 /// <param name="inboxConfiguration">Do we want to insert an inbox handler into pipelines without the attribute. Null (default = no), yes = how to configure</param>
 public CommandProcessor(
     IAmASubscriberRegistry subscriberRegistry,
     IAmAHandlerFactory handlerFactory,
     IAmARequestContextFactory requestContextFactory,
     IPolicyRegistry <string> policyRegistry,
     IAmAMessageMapperRegistry mapperRegistry,
     IAmAMessageProducer messageProducer,
     int outboxTimeout = 300,
     IAmAFeatureSwitchRegistry featureSwitchRegistry = null,
     IAmAChannelFactory responseChannelFactory       = null,
     InboxConfiguration inboxConfiguration           = null)
     : this(subscriberRegistry, handlerFactory, requestContextFactory, policyRegistry)
 {
     _mapperRegistry         = mapperRegistry;
     _messageProducer        = messageProducer;
     _outboxTimeout          = outboxTimeout;
     _featureSwitchRegistry  = featureSwitchRegistry;
     _responseChannelFactory = responseChannelFactory;
     _inboxConfiguration     = inboxConfiguration;
 }
 /// <summary>
 /// Initializes an Instance of <see cref="AzureServiceBusSubscription"/>
 /// </summary>
 /// <param name="dataType">The type for this Subscription.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="bufferSize">The number of messages to buffer on the channel</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMs">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="isAsync"></param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 /// <param name="subscriptionConfiguration">The configuration options for the subscriptions.</param>
 /// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
 /// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
 public AzureServiceBusSubscription(
     Type dataType,
     SubscriptionName name        = null,
     ChannelName channelName      = null,
     RoutingKey routingKey        = null,
     int bufferSize               = 1,
     int noOfPerformers           = 1,
     int timeoutInMilliseconds    = 400,
     int requeueCount             = -1,
     int requeueDelayInMs         = 0,
     int unacceptableMessageLimit = 0,
     bool isAsync = false,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create,
     AzureServiceBusSubscriptionConfiguration subscriptionConfiguration = null,
     int emptyChannelDelay   = 500,
     int channelFailureDelay = 1000)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMs, unacceptableMessageLimit, isAsync, channelFactory,
            makeChannels, emptyChannelDelay, channelFailureDelay)
 {
     Configuration = subscriptionConfiguration ?? new AzureServiceBusSubscriptionConfiguration();
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="name">The name. Defaults to the data type's full name.</param>
 /// <param name="channelName">The channel name. Defaults to the data type's full name.</param>
 /// <param name="routingKey">The routing key. Defaults to the data type's full name.</param>
 /// <param name="groupId">What is the id of the consumer group that this consumer belongs to; will not process the same partition as others in group</param>
 /// <param name="bufferSize">The number of messages to buffer at any one time, also the number of messages to retrieve at once. Min of 1 Max of 10</param>
 /// <param name="noOfPerformers">The no of threads reading this channel.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it.</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for.</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel.</param>
 /// <param name="offsetDefault">Where should we begin processing if we cannot find a stored offset</param>
 /// <param name="commitBatchSize">How often should we commit offsets?</param>
 /// <param name="sessionTimeoutMs">What is the heartbeat interval for this consumer, after which Kafka will assume dead and rebalance the consumer group</param>
 /// <param name="maxPollIntervalMs">How often does the consumer poll for a message to be considered alive, after which Kafka will assume dead and rebalance</param>
 /// <param name="sweepUncommittedOffsetsIntervalMs">How often do we commit offsets that have yet to be saved</param>
 /// <param name="isolationLevel">Should we read messages that are not on all replicas? May cause duplicates.</param>
 /// <param name="isAsync">Is this channel read asynchronously</param>
 /// <param name="numOfPartitions">How many partitions should this topic have - used if we create the topic</param>
 /// <param name="replicationFactor">How many copies of each partition should we have across our broker's nodes - used if we create the topic</param>       /// <param name="channelFactory">The channel factory to create channels for Consumer.</param>
 /// <param name="makeChannels">Should we make channels if they don't exist, defaults to creating</param>
 /// <param name="emptyChannelDelay">How long to pause when a channel is empty in milliseconds</param>
 /// <param name="channelFailureDelay">How long to pause when there is a channel failure in milliseconds</param>
 public KafkaSubscription(
     Type dataType,
     SubscriptionName name                 = null,
     ChannelName channelName               = null,
     RoutingKey routingKey                 = null,
     string groupId                        = null,
     int bufferSize                        = 1,
     int noOfPerformers                    = 1,
     int timeoutInMilliseconds             = 300,
     int requeueCount                      = -1,
     int requeueDelayInMilliseconds        = 0,
     int unacceptableMessageLimit          = 0,
     AutoOffsetReset offsetDefault         = AutoOffsetReset.Earliest,
     long commitBatchSize                  = 10,
     int sessionTimeoutMs                  = 10000,
     int maxPollIntervalMs                 = 300000,
     int sweepUncommittedOffsetsIntervalMs = 30000,
     IsolationLevel isolationLevel         = IsolationLevel.ReadCommitted,
     bool isAsync                      = false,
     int numOfPartitions               = 1,
     short replicationFactor           = 1,
     IAmAChannelFactory channelFactory = null,
     OnMissingChannel makeChannels     = OnMissingChannel.Create,
     int emptyChannelDelay             = 500,
     int channelFailureDelay           = 1000)
     : base(dataType, name, channelName, routingKey, bufferSize, noOfPerformers, timeoutInMilliseconds, requeueCount,
            requeueDelayInMilliseconds, unacceptableMessageLimit, isAsync, channelFactory, makeChannels, emptyChannelDelay, channelFailureDelay)
 {
     CommitBatchSize   = commitBatchSize;
     GroupId           = groupId;
     IsolationLevel    = isolationLevel;
     MaxPollIntervalMs = maxPollIntervalMs;
     SweepUncommittedOffsetsIntervalMs = sweepUncommittedOffsetsIntervalMs;
     OffsetDefault     = offsetDefault;
     SessionTimeoutMs  = sessionTimeoutMs;
     NumPartitions     = numOfPartitions;
     ReplicationFactor = replicationFactor;
 }
Example #18
0
 public INeedAListOfConnections WithChannelFactory(IAmAChannelFactory channelFactory)
 {
     this.channelFactory = channelFactory;
     return this;
 }
Example #19
0
 /// <summary>
 /// How do we build instances of the channel - sometimes this may build a consumer that builds the channel indirectly
 /// </summary>
 /// <param name="channelFactory">The channel to use</param>
 /// <returns></returns>
 public IConnectionBuilderChannelType ChannelFactory(IAmAChannelFactory channelFactory)
 {
     _channelFactory = channelFactory;
     return(this);
 }
Example #20
0
 public ConnectionFactory(IAmAChannelFactory channelFactory)
 {
     _channelFactory = channelFactory;
 }
Example #21
0
 public IConnectionBuilderChannelType ChannelFactory(IAmAChannelFactory inputChannelFactory)
 {
     _inputChannelFactory = inputChannelFactory;
     return(this);
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer</param>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="routingKey">The routing key</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel</param>
 /// <param name="channelName">The channel name</param>
 /// <param name="isDurable">The durability of the queue</param>
 public Connection(ConnectionName name, IAmAChannelFactory channelFactory, Type dataType, ChannelName channelName, string routingKey, int noOfPerformers = 1, int timeoutInMilliseconds = 300, int requeueCount = -1, int requeueDelayInMilliseconds = 0, int unacceptableMessageLimit = 0, bool isDurable = false)
 {
     RequeueCount = requeueCount;
     Name = name;
     ChannelFactory = channelFactory;
     DataType = dataType;
     NoOfPeformers = noOfPerformers;
     TimeoutInMiliseconds = timeoutInMilliseconds;
     UnacceptableMessageLimit = unacceptableMessageLimit;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     ChannelName = channelName;
     RoutingKey = routingKey;
     IsDurable = isDurable;
 }
 /// <summary>
 /// The channel factory - used to create channels. Generally an implementation of a specific Application Layer i.e.RabbitMQ for AMQP
 /// needs to provide an implementation of this factory to provide input and output channels that support sending messages over that
 /// layer. We provide an implementation for RabbitMQ for example.
 /// </summary>
 /// <param name="channelFactory">The channel factory.</param>
 /// <returns>INeedAListOfConnections.</returns>
 public IAmADispatchBuilder ChannelFactory(IAmAChannelFactory channelFactory)
 {
     _channelFactory = channelFactory;
     return this;
 }
Example #24
0
 public IConnectionBuilderChannelType ChannelFactory(IAmAChannelFactory inputChannelFactory)
 {
     _inputChannelFactory = inputChannelFactory;
     return this;
 }
Example #25
0
 public Connection(ConnectionName name, IAmAChannelFactory channelFactory, Type dataType, ChannelName channelName, RoutingKey routingKey, int noOfPerformers = 1, int timeoutInMilliseconds = 300, int requeueCount = -1, int requeueDelayInMilliseconds = 0, int unacceptableMessageLimit = 0, bool isDurable = false, bool isAsync = false)
     : this(dataType, name, channelName, routingKey, noOfPerformers, timeoutInMilliseconds, requeueCount, requeueDelayInMilliseconds, unacceptableMessageLimit, isDurable, isAsync, channelFactory)
 {
 }
Example #26
0
 /// <summary>
 /// The channel factory - used to create channels. Generally an implementation of a specific Application Layer i.e.RabbitMQ for AMQP 
 /// needs to provide an implementation of this factory to provide input and output channels that support sending messages over that
 /// layer. We provide an implementation for RabbitMQ for example.
 /// </summary>
 /// <param name="channelFactory">The channel factory.</param>
 /// <returns>INeedAListOfConnections.</returns>
 public INeedAListOfConnections ChannelFactory(IAmAChannelFactory channelFactory)
 {
     return this;
 }
Example #27
0
 public ConnectionFactory(IAmAChannelFactory channelFactory)
 {
     _channelFactory = channelFactory;
 }
Example #28
0
 public ControlBusBuilder ChannelFactory(IAmAChannelFactory channelFactory)
 {
     this.channelFactory = channelFactory;
     return(this);
 }
Example #29
0
 /// <summary>
 /// The channel factory - used to create channels. Generally an implementation of a specific Application Layer i.e.RabbitMQ for AMQP
 /// needs to provide an implementation of this factory to provide input and output channels that support sending messages over that
 /// layer. We provide an implementation for RabbitMQ for example.
 /// </summary>
 /// <param name="channelFactory">The channel factory.</param>
 /// <returns>INeedAListOfConnections.</returns>
 public INeedAListOfConnections ChannelFactory(IAmAChannelFactory channelFactory)
 {
     this.channelFactory = channelFactory;
     return(this);
 }
Example #30
0
 /// <summary>
 /// The channel factory - used to create channels. Generally an implementation of a specific Application Layer i.e.RabbitMQ for AMQP
 /// needs to provide an implementation of this factory to provide input and output channels that support sending messages over that
 /// layer. We provide an implementation for RabbitMQ for example.
 /// </summary>
 /// <param name="channelFactory">The channel factory.</param>
 /// <returns>INeedAListOfConnections.</returns>
 public IAmADispatchBuilder ChannelFactory(IAmAChannelFactory channelFactory)
 {
     _channelFactory = channelFactory;
     return(this);
 }
Example #31
0
 /// <summary>
 /// The default channel factory - used to create channels. Generally an implementation of a specific Application Layer i.e.RabbitMQ for AMQP
 /// needs to provide an implementation of this factory to provide input and output channels that support sending messages over that
 /// layer. We provide an implementation for RabbitMQ for example.
 /// </summary>
 /// <param name="channelFactory">The channel factory.</param>
 /// <returns>INeedAListOfConnections.</returns>
 public INeedAListOfConnections DefaultChannelFactory(IAmAChannelFactory channelFactory)
 {
     _defaultChannelFactory = channelFactory;
     return(this);
 }