コード例 #1
0
        public ServeController(IServeService serveService, IConfigurationWrapper configuration, IMessageFactory messageFactory, IMessageQueueFactory messageQueueFactory)
        {
            _serveService = serveService;
            _messageFactory = messageFactory;

            var eventQueueName = configuration.GetConfigValue("SignupToServeEventQueue");
            _eventQueue = messageQueueFactory.CreateQueue(eventQueueName, QueueAccessMode.Send);
            _messageFactory = messageFactory;
        }
コード例 #2
0
        public TripApplicationController(ITripService tripService, IConfigurationWrapper configuration, IMessageFactory messageFactory, IMessageQueueFactory messageQueueFactory)
        {
            _tripService = tripService;
            _messageFactory = messageFactory;

            var eventQueueName = configuration.GetConfigValue("TripApplicationEventQueue");
            _eventQueue = messageQueueFactory.CreateQueue(eventQueueName, QueueAccessMode.Send);
            _messageFactory = messageFactory;
        }
コード例 #3
0
        public StripeEventController(IConfigurationWrapper configuration, IStripeEventService stripeEventService = null,
            IMessageQueueFactory messageQueueFactory = null, IMessageFactory messageFactory = null)
        {
            var b = configuration.GetConfigValue("StripeWebhookLiveMode");
            _liveMode = b != null && bool.Parse(b);

            b = configuration.GetConfigValue("StripeWebhookAsynchronousProcessingMode");
            _asynchronous = b != null && bool.Parse(b);
            if (_asynchronous)
            {
                var eventQueueName = configuration.GetConfigValue("StripeWebhookEventQueueName");
                _eventQueue = messageQueueFactory.CreateQueue(eventQueueName, QueueAccessMode.Send);
                _messageFactory = messageFactory;
            }
            else
            {
                _stripeEventService = stripeEventService;
            }
        }
コード例 #4
0
        public CheckScannerController(IConfigurationWrapper configuration,
                                      ICheckScannerService checkScannerService,
                                      IAuthenticationService authenticationService,
                                      ICommunicationService communicationService,
                                      ICryptoProvider cryptoProvider,
                                      IMessageQueueFactory messageQueueFactory = null,
                                      IMessageFactory messageFactory = null)
        {
            _checkScannerService = checkScannerService;
            _authenticationService = authenticationService;
            _communicationService = communicationService;
            _cryptoProvider = cryptoProvider;

            var b = configuration.GetConfigValue("CheckScannerDonationsAsynchronousProcessingMode");
            _asynchronous = b != null && bool.Parse(b);
            if (_asynchronous)
            {
                var donationsQueueName = configuration.GetConfigValue("CheckScannerDonationsQueueName");
                // ReSharper disable once PossibleNullReferenceException
                _donationsQueue = messageQueueFactory.CreateQueue(donationsQueueName, QueueAccessMode.Send);
                _messageFactory = messageFactory;
            }
        }
コード例 #5
0
 /// <summary>
 /// Ensure that the MessageQueueObject name is set and creates a 
 /// <see cref="DefaultMessageQueueFactory"/> if no <see cref="IMessageQueueFactory"/>
 /// is specified.
 /// </summary>
 /// <remarks>Will attempt to create an instance of the DefaultMessageQueue to detect early
 /// any configuraiton errors.</remarks>
 /// <exception cref="System.Exception">
 /// In the event of misconfiguration (such as the failure to set a
 /// required property) or if initialization fails.
 /// </exception>
 public virtual void AfterPropertiesSet()
 {
     if (MessageQueueObjectName == null)
     {
         throw new ArgumentException("The DefaultMessageQueueObjectName property has not been set.");
     }
     if (messageQueueFactory == null)
     {
         DefaultMessageQueueFactory mqf = new DefaultMessageQueueFactory();
         mqf.ApplicationContext = applicationContext;
         messageQueueFactory = mqf;
     }
     //Create an instance so we can 'fail-fast' if there isn't an DefaultMessageQueue unde 
     MessageQueue mq = MessageQueueFactory.CreateMessageQueue(messageQueueObjectName);
 }
コード例 #6
0
 public UnsubscribeController(IMessageQueueFactory queueFactory)
 {
     _userExist = queueFactory.Get("doesuserexist");
     _userExistResponse = _userExist.GetResponseQueue();
     _unsubscribe = queueFactory.Get("unsubscribe");
 }
コード例 #7
0
        /// <summary>
        /// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
        /// after it has injected all of an object's dependencies.
        /// </summary>
        /// <remarks>
        /// Ensure that the DefaultMessageQueueObjectName property is set, creates 
        /// a default implementation of the <see cref="IMessageQueueFactory"/> interface
        /// (<see cref="DefaultMessageQueueFactory"/>) that retrieves instances on a per-thread
        /// basis, and registers in the Spring container a default implementation of 
        /// <see cref="IMessageConverter"/> (<see cref="XmlMessageConverter"/>) with a
        /// simple System.String as its TargetType.  <see cref="QueueUtils.RegisterDefaultMessageConverter"/>
        /// </remarks>
        public void AfterPropertiesSet()
        {
            if (MessageQueueFactory == null)
            {
                AssertUtils.ArgumentNotNull(applicationContext, "MessageQueueTemplate requires the ApplicationContext property to be set if the MessageQueueFactory property is not set for automatic create of the DefaultMessageQueueFactory");

                DefaultMessageQueueFactory mqf = new DefaultMessageQueueFactory();
                mqf.ApplicationContext = applicationContext;
                messageQueueFactory = mqf;
            }
            if (messageConverterObjectName == null)
            {
                messageConverterObjectName = QueueUtils.RegisterDefaultMessageConverter(applicationContext);
            }
            //If it has not been set by the user explicitly, then initialize.
            CreateDefaultMetadataCache();
        }
コード例 #8
0
 /// <summary>
 /// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
 /// after it has injected all of an object's dependencies.
 /// </summary>
 /// <remarks>
 /// 	<p>
 /// This method allows the object instance to perform the kind of
 /// initialization only possible when all of it's dependencies have
 /// been injected (set), and to throw an appropriate exception in the
 /// event of misconfiguration.
 /// </p>
 /// 	<p>
 /// Please do consult the class level documentation for the
 /// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a
 /// description of exactly <i>when</i> this method is invoked. In
 /// particular, it is worth noting that the
 /// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/>
 /// and <see cref="Spring.Context.IApplicationContextAware"/>
 /// callbacks will have been invoked <i>prior</i> to this method being
 /// called.
 /// </p>
 /// </remarks>
 /// <exception cref="System.Exception">
 /// In the event of misconfiguration (such as the failure to set a
 /// required property) or if initialization fails.
 /// </exception>
 public void AfterPropertiesSet()
 {
     if (messageQueueFactory == null)
     {
         DefaultMessageQueueFactory mqf = new DefaultMessageQueueFactory();
         mqf.ApplicationContext = applicationContext;
         messageQueueFactory = mqf;
     }
     if (messageConverterObjectName == null)
     {
         messageConverterObjectName = QueueUtils.RegisterDefaultMessageConverter(applicationContext);
     }
     if (messageQueueTemplate == null)
     {
         messageQueueTemplate = new MessageQueueTemplate();
         messageQueueTemplate.ApplicationContext = ApplicationContext;
         messageQueueTemplate.AfterPropertiesSet();
     }
 }
コード例 #9
0
 public UnsubscribeWorkflow(string emailAddress, IMessageQueueFactory queueFactory)
 {
     EmailAddress = emailAddress;
     _queueFactory = queueFactory;
 }