/// <summary> /// The <see cref="CommandProcessor"/> wants to support <see cref="CommandProcessor.Post{T}(T)"/> or <see cref="CommandProcessor.Repost"/> using Task Queues. /// You need to provide a policy to specify how QoS issues, specifically <see cref="CommandProcessor.RETRYPOLICY "/> or <see cref="CommandProcessor.CIRCUITBREAKER "/> /// are handled by adding appropriate <see cref="Policies"/> when choosing this option. /// /// </summary> /// <param name="configuration">The Task Queues configuration.</param> /// <returns>INeedARequestContext.</returns> public INeedARequestContext TaskQueues(MessagingConfiguration configuration) { _useTaskQueues = true; _messageStore = configuration.MessageStore; _asyncMessageStore = configuration.AsyncMessageStore; _messagingGateway = configuration.MessageProducer; _asyncMessagingGateway = configuration.AsyncMessageProducer; _messageMapperRegistry = configuration.MessageMapperRegistry; _messageStoreWriteTimeout = configuration.MessageStoreWriteTimeout; _messagingGatewaySendTimeout = configuration.MessagingGatewaySendTimeout; return(this); }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when only task queue support is required /// </summary> /// <param name="requestContextFactory">The request context factory.</param> /// <param name="policyRegistry">The policy registry.</param> /// <param name="mapperRegistry">The mapper registry.</param> /// <param name="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param> /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param> public CommandProcessor( IAmARequestContextFactory requestContextFactory, IAmAPolicyRegistry policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300 ) : this( requestContextFactory, policyRegistry, mapperRegistry, asyncMessageStore, asyncMessageProducer, LogProvider.GetCurrentClassLogger(), messageStoreTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="MessagingConfiguration"/> class. /// </summary> /// <param name="asyncMessageStore">The message store that supports async/await.</param> /// <param name="asyncmessageProducer">The messaging gateway that supports async/await.</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( IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncmessageProducer, IAmAMessageMapperRegistry messageMapperRegistry, int messageStoreWriteTimeout = 300, int messagingGatewaySendTimeout = 300 ) { AsyncMessageStore = asyncMessageStore; AsyncMessageProducer = asyncmessageProducer; MessageMapperRegistry = messageMapperRegistry; MessageStoreWriteTimeout = messageStoreWriteTimeout; MessagingGatewaySendTimeout = messagingGatewaySendTimeout; }
/// <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; _messageStore = configuration.MessageStore; _asyncMessageStore = configuration.AsyncMessageStore; _messagingGateway = configuration.MessageProducer; _asyncMessagingGateway = configuration.AsyncMessageProducer; _messageMapperRegistry = configuration.MessageMapperRegistry; _messageStoreWriteTimeout = configuration.MessageStoreWriteTimeout; _messagingGatewaySendTimeout = configuration.MessagingGatewaySendTimeout; _responseChannelFactory = configuration.ResponseChannelFactory; return(this); }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when only task queue support is required /// </summary> /// <param name="requestContextFactory">The request context factory.</param> /// <param name="policyRegistry">The policy registry.</param> /// <param name="mapperRegistry">The mapper registry.</param> /// <param name="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param> /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param> public CommandProcessor( IAmARequestContextFactory requestContextFactory, IAmAPolicyRegistry policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300) { _requestContextFactory = requestContextFactory; _policyRegistry = policyRegistry; _messageStoreTimeout = messageStoreTimeout; _mapperRegistry = mapperRegistry; _asyncMessageStore = asyncMessageStore; _asyncMessageProducer = asyncMessageProducer; }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when both task queue and command processor support is required /// </summary> /// <param name="subscriberRegistry">The subscriber registry.</param> /// <param name="asyncHandlerFactory">The async 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="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param> /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param> public CommandProcessor( IAmASubscriberRegistry subscriberRegistry, IAmAHandlerFactoryAsync asyncHandlerFactory, IAmARequestContextFactory requestContextFactory, IAmAPolicyRegistry policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300 ) : this( subscriberRegistry, asyncHandlerFactory, requestContextFactory, policyRegistry, mapperRegistry, asyncMessageStore, asyncMessageProducer, LogProvider.For <CommandProcessor>(), messageStoreTimeout) { }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when both task queue and command processor support is required /// </summary> /// <param name="subscriberRegistry">The subscriber registry.</param> /// <param name="asyncHandlerFactory">The async 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="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param> /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param> public CommandProcessor( IAmASubscriberRegistry subscriberRegistry, IAmAHandlerFactoryAsync asyncHandlerFactory, IAmARequestContextFactory requestContextFactory, IAmAPolicyRegistry policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300) : this(subscriberRegistry, asyncHandlerFactory, requestContextFactory, policyRegistry) { _mapperRegistry = mapperRegistry; _asyncMessageStore = asyncMessageStore; _asyncMessageProducer = asyncMessageProducer; _messageStoreTimeout = messageStoreTimeout; }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when both task queue and command processor support is required /// </summary> /// <param name="subscriberRegistry">The subscriber registry.</param> /// <param name="asyncHandlerFactory">The async 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="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</param> /// <param name="messageStoreTimeout">How long should we wait to write to the message store</param> /// <param name="messageGatewaySendTimeout">How long should we wait to post to the message store</param> public CommandProcessor( IAmASubscriberRegistry subscriberRegistry, IAmAHandlerFactoryAsync asyncHandlerFactory, IAmARequestContextFactory requestContextFactory, IAmAPolicyRegistry policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300, int messageGatewaySendTimeout = 300 ) : this( subscriberRegistry, asyncHandlerFactory, requestContextFactory, policyRegistry, mapperRegistry, asyncMessageStore, asyncMessageProducer, LogProvider.GetCurrentClassLogger()) { }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when only task queue support is required /// </summary> /// <param name="requestContextFactory">The request context factory.</param> /// <param name="policyRegistry">The policy registry.</param> /// <param name="mapperRegistry">The mapper registry.</param> /// <param name="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</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( IAmARequestContextFactory requestContextFactory, IPolicyRegistry <string> policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300, IAmAFeatureSwitchRegistry featureSwitchRegistry = null) { _requestContextFactory = requestContextFactory; _policyRegistry = policyRegistry; _messageStoreTimeout = messageStoreTimeout; _mapperRegistry = mapperRegistry; _asyncMessageStore = asyncMessageStore; _asyncMessageProducer = asyncMessageProducer; _featureSwitchRegistry = featureSwitchRegistry; }
/// <summary> /// Initializes a new instance of the <see cref="CommandProcessor"/> class. /// Use this constructor when both task queue and command processor support is required /// </summary> /// <param name="subscriberRegistry">The subscriber registry.</param> /// <param name="asyncHandlerFactory">The async 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="asyncMessageStore">The message store supporting async/await.</param> /// <param name="asyncMessageProducer">The messaging gateway supporting async/await.</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, IAmAHandlerFactoryAsync asyncHandlerFactory, IAmARequestContextFactory requestContextFactory, IPolicyRegistry <string> policyRegistry, IAmAMessageMapperRegistry mapperRegistry, IAmAMessageStoreAsync <Message> asyncMessageStore, IAmAMessageProducerAsync asyncMessageProducer, int messageStoreTimeout = 300, IAmAFeatureSwitchRegistry featureSwitchRegistry = null) : this(subscriberRegistry, asyncHandlerFactory, requestContextFactory, policyRegistry, featureSwitchRegistry) { _mapperRegistry = mapperRegistry; _asyncMessageStore = asyncMessageStore; _asyncMessageProducer = asyncMessageProducer; _messageStoreTimeout = messageStoreTimeout; _featureSwitchRegistry = featureSwitchRegistry; }
/// <summary> /// The <see cref="CommandProcessor"/> wants to support <see cref="CommandProcessor.Post{T}(T)"/> or <see cref="CommandProcessor.Repost"/> using Task Queues. /// You need to provide a policy to specify how QoS issues, specifically <see cref="CommandProcessor.RETRYPOLICY "/> or <see cref="CommandProcessor.CIRCUITBREAKER "/> /// are handled by adding appropriate <see cref="Policies"/> when choosing this option. /// /// </summary> /// <param name="configuration">The Task Queues configuration.</param> /// <returns>INeedARequestContext.</returns> public INeedARequestContext TaskQueues(MessagingConfiguration configuration) { _useTaskQueues = true; _messageStore = configuration.MessageStore; _asyncMessageStore = configuration.AsyncMessageStore; _messagingGateway = configuration.MessageProducer; _asyncMessagingGateway = configuration.AsyncMessageProducer; _messageMapperRegistry = configuration.MessageMapperRegistry; _messageStoreWriteTimeout = configuration.MessageStoreWriteTimeout; _messagingGatewaySendTimeout = configuration.MessagingGatewaySendTimeout; return this; }
/// <summary> /// Initializes a new instance of the <see cref="MessagingConfiguration"/> class. /// </summary> /// <param name="messageStore">The message store.</param> /// <param name="asyncMessageStore">The message store that supports async/await.</param> /// <param name="messageProducer">The messaging gateway.</param> /// <param name="asyncmessageProducer">The messaging gateway that supports async/await.</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, IAmAMessageStoreAsync<Message> asyncMessageStore, IAmAMessageProducer messageProducer, IAmAMessageProducerAsync asyncmessageProducer, IAmAMessageMapperRegistry messageMapperRegistry, int messageStoreWriteTimeout = 300, int messagingGatewaySendTimeout = 300 ) { MessageStore = messageStore; AsyncMessageStore = asyncMessageStore; MessageProducer = messageProducer; AsyncMessageProducer = asyncmessageProducer; MessageMapperRegistry = messageMapperRegistry; MessageStoreWriteTimeout = messageStoreWriteTimeout; MessagingGatewaySendTimeout = messagingGatewaySendTimeout; }