예제 #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);
        }
예제 #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;
        }
예제 #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;
 }
예제 #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;
            }
        }
예제 #5
0
파일: Timeout.cs 프로젝트: DM-TOR/nhin-d
        /// <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;
            }
        }
예제 #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);
        }
예제 #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);
예제 #8
0
파일: Timeout.cs 프로젝트: DM-TOR/nhin-d
 /// <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);