/// <summary>
        ///     Initializes a new instance of the <see cref="EmailSubscriptionHostFactory" /> class.
        /// </summary>
        public EmailSubscriptionHostFactory()
        {
            try
            {
                string storageAccountConnectionString = this.GetMandatorySetting("StorageAccountConnectionString");

                // User Dal
                string usersConnectionString = this.GetMandatorySetting("UsersDalConnectionString");
                this.usersDal = new UsersDal(usersConnectionString, null, false, new PriorityEmailJobsQueue <PriorityEmailCargo>(storageAccountConnectionString));

                // HCP commands queue
                int      queueMaxRetries          = int.Parse(this.GetMandatorySetting("QueueMaxRetriesNumber"));
                TimeSpan queueRetriesDeltaBackoff = TimeSpan.Parse(this.GetMandatorySetting("QueueRetriesDeltaBackoff"));
                this.hcpCommandsQueue = new HcpCommandsAzureQueue(storageAccountConnectionString, queueMaxRetries, queueRetriesDeltaBackoff);

                // Other settings
                this.mdmApplicationId       = int.Parse(this.GetMandatorySetting("MdMApplicationId"));
                this.publicationDescription = this.GetMandatorySetting("PublicationDescription");
                this.publicationId          = this.GetMandatorySetting("PublicationId");
                this.publicationName        = this.GetMandatorySetting("PublicationName");
                this.publicationOptinLink   = this.GetMandatorySetting("PublicationOptinLink");
            }
            catch (Exception e)
            {
                Log.Error(e, "Couldn't initialize email subscriptions host factory");
                throw;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UnsubscribeServiceInstanceProvider"/> class.
        /// </summary>
        /// <param name="hcpCommandsQueue">
        /// The hcp commands queue
        /// </param>
        /// <param name="serviceSettings">
        /// The unsubscribe service settings.
        /// </param>
        public SuppressUserInstanceProvider(IHcpCommandsQueue hcpCommandsQueue)
        {
            if (hcpCommandsQueue == null)
            {
                throw new ArgumentNullException("hcpCommandsQueue");
            }

            this.hcpCommandsQueue = hcpCommandsQueue;
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SuppressUserService"/> class.
        /// </summary>
        /// <param name="hcpCommandsQueue"> The hcp commands queue. </param>
        /// <exception cref="ArgumentNullException">settings or hcp commands queue are null </exception>
        public SuppressUserService(IHcpCommandsQueue hcpCommandsQueue)
        {
            if (hcpCommandsQueue == null)
            {
                throw new ArgumentNullException("hcpCommandsQueue");
            }

            this.hcpCommandsQueue = hcpCommandsQueue;
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SuppressUserServiceHost"/> class.
        /// </summary>
        /// <param name="hcpCommandsQueue">
        /// The hcp commands queue
        /// </param>
        /// <param name="serviceType">
        /// The service type.
        /// </param>
        /// <param name="baseAddresses">
        /// The base addresses.
        /// </param>
        public SuppressUserServiceHost(IHcpCommandsQueue hcpCommandsQueue, Type serviceType, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        {
            if (hcpCommandsQueue == null)
            {
                throw new ArgumentNullException("hcpCommandsQueue");
            }

            foreach (ContractDescription cd in this.ImplementedContracts.Values)
            {
                cd.Behaviors.Add(new SuppressUserInstanceProvider(hcpCommandsQueue));
            }
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UnsubscribeServiceInstanceProvider"/> class.
        /// </summary>
        /// <param name="hcpCommandsQueue">
        /// The hcp commands queue
        /// </param>
        /// <param name="serviceSettings">
        /// The unsubscribe service settings.
        /// </param>
        public UnsubscribeServiceInstanceProvider(IHcpCommandsQueue hcpCommandsQueue, UnsubscribeServiceSettings serviceSettings)
        {
            if (hcpCommandsQueue == null)
            {
                throw new ArgumentNullException("hcpCommandsQueue");
            }

            if (serviceSettings == null)
            {
                throw new ArgumentNullException("serviceSettings");
            }

            this.unsubscribeServiceSettings = serviceSettings;
            this.hcpCommandsQueue           = hcpCommandsQueue;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UnsubscribeServiceHost"/> class.
        /// </summary>
        /// <param name="hcpCommandsQueue">
        /// The hcp commands queue
        /// </param>
        /// <param name="serviceSettings">
        /// The unsubscribe service settings.
        /// </param>
        /// <param name="serviceType">
        /// The service type.
        /// </param>
        /// <param name="baseAddresses">
        /// The base addresses.
        /// </param>
        public UnsubscribeServiceHost(IHcpCommandsQueue hcpCommandsQueue, UnsubscribeServiceSettings serviceSettings, Type serviceType, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        {
            if (hcpCommandsQueue == null)
            {
                throw new ArgumentNullException("hcpCommandsQueue");
            }

            if (serviceSettings == null)
            {
                throw new ArgumentNullException("serviceSettings");
            }

            foreach (ContractDescription cd in this.ImplementedContracts.Values)
            {
                cd.Behaviors.Add(new UnsubscribeServiceInstanceProvider(hcpCommandsQueue, serviceSettings));
            }
        }