Beispiel #1
0
        /// <summary>
        /// Retrieve expired records.
        ///     Records without processed notification and older than the <c>ExpiredMinutes</c>
        ///     Load a limited amount of record set by <c>BulkCount</c>
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        protected override IList <Mdn> ExpiredMdns(TimeoutSettings settings)
        {
            IList <Mdn> mdns;

            mdns = MDNManager.GetExpiredProcessed(settings.ExpiredMinutes, settings.BulkCount).ToList();
            if (mdns.Count() > 0)
            {
                Logger.Debug("Processing {0} expired processed mdns", mdns.Count());
            }

            return(mdns);
        }
Beispiel #2
0
        /// <summary>
        /// Retrieve expired records.
        ///     Records without processed notification and older than the <c>ExpiredMinutes</c>
        ///     Load a limited amount of record set by <c>BulkCount</c>
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        protected override IList<Mdn> ExpiredMdns(TimeoutSettings settings)
        {
            IList<Mdn> mdns;

            mdns = MDNManager.GetExpiredProcessed(settings.ExpiredMinutes, settings.BulkCount).ToList();
            if (mdns.Count() > 0)
            {
                Logger.Debug("Processing {0} expired processed mdns", mdns.Count());
            }
            
            return mdns;
        }
Beispiel #3
0
 static DSNMessage CreateNotificationMessage(Mdn mdn, TimeoutSettings settings)
 {
     var perMessage = new DSNPerMessage(settings.ProductName, mdn.MessageId);
     var perRecipient = new DSNPerRecipient(DSNStandard.DSNAction.Failed, DSNStandard.DSNStatus.Permanent
                                            , DSNStandard.DSNStatus.NETWORK_EXPIRED_PROCESSED,
                                            MailParser.ParseMailAddress(mdn.Recipient));
     //
     // The nature of Mdn storage in config store does not result in a list of perRecipients
     // If you would rather send one DSN with muliple recipients then one could write their own Job.
     //
     var notification = new DSN(perMessage, new List<DSNPerRecipient> { perRecipient });
     var sender = new MailAddress(mdn.Sender);
     var notificationMessage = new DSNMessage(sender.Address, new MailAddress("Postmaster@" + sender.Host).Address, notification);
     notificationMessage.AssignMessageID();
     notificationMessage.SubjectValue = string.Format("{0}:{1}", "Rejected", mdn.SubjectValue);
     notificationMessage.Timestamp();
     return notificationMessage;
 }
Beispiel #4
0
        /// <summary>
        /// Load applicatioin settings and job settings
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected TimeoutSettings Load(JobExecutionContext context)
        {
            try
            {
                var settings = new TimeoutSettings(context);
                m_store  = new ConfigStore(settings.ConnectionString, settings.QueryTimeout);
                m_logger = Log.For(this);

                MDNManager = new MdnManager(new ConfigStore(settings.ConnectionString));

                return(settings);
            }
            catch (Exception e)
            {
                WriteToEventLog(e);
                var je = new JobExecutionException(e);
                je.UnscheduleAllTriggers = true;
                throw je;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Load applicatioin settings and job settings
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected TimeoutSettings Load(JobExecutionContext context)
        {
            try
            {
                var settings = new TimeoutSettings(context);
                m_store = new ConfigStore(settings.ConnectionString, settings.QueryTimeout);
                m_logger = Log.For(this);
                
                MDNManager = new MdnManager(new ConfigStore(settings.ConnectionString));

                return settings;
            }
            catch (Exception e)
            {
                WriteToEventLog(e);
                var je = new JobExecutionException(e);
                je.UnscheduleAllTriggers = true;
                throw je;
            }
        }
Beispiel #6
0
        static DSNMessage CreateNotificationMessage(Mdn mdn, TimeoutSettings settings)
        {
            var perMessage   = new DSNPerMessage(settings.ProductName, mdn.MessageId);
            var perRecipient = new DSNPerRecipient(DSNStandard.DSNAction.Failed, DSNStandard.DSNStatus.Permanent
                                                   , DSNStandard.DSNStatus.NETWORK_EXPIRED_PROCESSED,
                                                   MailParser.ParseMailAddress(mdn.Recipient));
            //
            // The nature of Mdn storage in config store does not result in a list of perRecipients
            // If you would rather send one DSN with muliple recipients then one could write their own Job.
            //
            var notification = new DSN(perMessage, new List <DSNPerRecipient> {
                perRecipient
            });
            var sender = new MailAddress(mdn.Sender);
            var notificationMessage = new DSNMessage(sender.Address, new MailAddress("Postmaster@" + sender.Host).Address, notification);

            notificationMessage.AssignMessageID();
            notificationMessage.SubjectValue = string.Format("{0}:{1}", "Rejected", mdn.SubjectValue);
            notificationMessage.Timestamp();
            return(notificationMessage);
        }
Beispiel #7
0
 /// <summary>
 /// Get queued mdns that are considered expired based on type of <c>Timeout</c>
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 protected abstract IList <Mdn> ExpiredMdns(TimeoutSettings settings);
Beispiel #8
0
 /// <summary>
 /// Get queued mdns that are considered expired based on type of <c>Timeout</c>
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 protected abstract IList<Mdn> ExpiredMdns(TimeoutSettings settings);