コード例 #1
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            MessengerConfiguration cfg = new MessengerConfiguration();

            cfg.RetrieveMessageInterval = Convert.ToInt32(GetAttribute("retrieveMessageInterval", section, "60000"));
            cfg.RetryInterval           = Convert.ToInt32(GetAttribute("retryInterval", section, "3000"));
            cfg.SendInterval            = Convert.ToInt32(GetAttribute("sendInterval", section, "3000"));
            cfg.RetryLimit                 = Convert.ToInt32(GetAttribute("retryLimit", section, "3"));
            cfg.ReloadMessageLimit         = Convert.ToInt32(GetAttribute("reloadMessageLimit", section, "20"));
            cfg.BeginSmsTransmissionPeriod = TimeSpan.Parse(GetAttribute("beginSmsTransmisionPeriod", section, "08:00"));
            cfg.EndSmsTransmissionPeriod   = TimeSpan.Parse(GetAttribute("endSmsTransmisionPeriod", section, "22:00"));
            cfg.SmsServiceProvider         = GetAttribute("smsServiceProvider", section, null);
            cfg.SmsServiceParameters       = GetProviderConfiguration(section.SelectSingleNode("smsProvider"));
            cfg.MailServer                 = GetMailServerConfiguration(section.SelectSingleNode("mailServer"));

            //REQUIRED
            cfg.GetMessageStoredProcedure                    = GetAttribute("getMessageSP", section);
            cfg.GetMessageAttachmentsStoredProcedure         = GetAttribute("getMessageAttachmentsSP", section);
            cfg.SetMessageTransmissionSuccessStoredProcedure = GetAttribute("setSuccessSP", section);
            cfg.SetMessageTransmissionErrorStoredProcedure   = GetAttribute("setErrorSP", section);
            cfg.ServiceName = GetAttribute("name", section);

            if (ConfigurationManager.ConnectionStrings["messengerDB"] == null)
            {
                throw new ConfigurationErrorsException("Nie zdefiniowano połączenia do bazy o nazwie messengerDB");
            }
            else
            {
                cfg.MessageDBConnectionString = ConfigurationManager.ConnectionStrings["messengerDB"].ConnectionString;
            }

            return(cfg);
        }
コード例 #2
0
ファイル: MessageService.cs プロジェクト: MakoLab/fractus
        public MessageService(MessengerConfiguration configuration, ILog log, IMessageMapper mapper, IMessageProviderFactory factory)
        {
            this.State = MessengerState.Stopped;

            this.logger          = log;
            this.Configuration   = configuration;
            this.ProviderFactory = factory;
            this.Mapper          = mapper;
        }
コード例 #3
0
ファイル: MessageService.cs プロジェクト: MakoLab/fractus
 public MessageService(MessengerConfiguration configuration, ILog log)
     : this(configuration, log, new MessageMapper(configuration.MessageDBConnectionString,
                                                  configuration.GetMessageStoredProcedure,
                                                  configuration.GetMessageAttachmentsStoredProcedure,
                                                  configuration.SetMessageTransmissionSuccessStoredProcedure,
                                                  configuration.SetMessageTransmissionErrorStoredProcedure),
            new MessageProviderFactory(configuration, log))
 {
 }