/[projects]/dao/DaoMqPump2/MQFilter/FilterController.cs
ViewVC logotype

Diff of /dao/DaoMqPump2/MQFilter/FilterController.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2177 by torben, Mon May 19 19:51:47 2014 UTC revision 2183 by torben, Wed May 21 09:56:21 2014 UTC
# Line 16  namespace MQFilter Line 16  namespace MQFilter
16      class FilterController      class FilterController
17      {      {
18    
19            public const int TRANSACTIONS_PER_RUN = 2000;
20    
21          public string mqHost { get; private set; }          public string mqHost { get; private set; }
22          public string mqChannel { get; private set; }          public string mqChannel { get; private set; }
23          public string mqQueueManager { get; private set; }          public string mqQueueManager { get; private set; }
# Line 32  namespace MQFilter Line 34  namespace MQFilter
34          public static readonly string queueNameMysql = "DAO.ALL";          public static readonly string queueNameMysql = "DAO.ALL";
35          public static readonly string queueNameStore = "DAO.STORE";          public static readonly string queueNameStore = "DAO.STORE";
36    
37            TimeSpan silentPeriodBegin;
38            TimeSpan silentPeriodEnd;
39    
40          protected FilterController()          protected FilterController()
41          {          {
# Line 84  namespace MQFilter Line 88  namespace MQFilter
88    
89              ////////////              ////////////
90    
91                string silentBeginStr = (string)key.GetValue("SilentPeriodBegin");
92                if (silentBeginStr == null || silentBeginStr.Length == 0)
93                {
94                    key.SetValue("SilentPeriodBegin", "", RegistryValueKind.String);
95                    throw new System.ArgumentException("SilentPeriodBegin cannot be null or empty");
96                }
97                silentPeriodBegin = TimeSpan.Parse(silentBeginStr);
98    
99                string silentEndStr = (string)key.GetValue("SilentPeriodEnd");
100                if (silentEndStr == null || silentEndStr.Length == 0)
101                {
102                    key.SetValue("SilentPeriodEnd", "", RegistryValueKind.String);
103                    throw new System.ArgumentException("SilentPeriodEnd cannot be null or empty");
104                }
105                silentPeriodEnd = TimeSpan.Parse(silentEndStr);
106    
107                ////////////
108    
109              String tmpFilterTransactions = (string)key.GetValue("FilterTransactions");              String tmpFilterTransactions = (string)key.GetValue("FilterTransactions");
110              if (tmpFilterTransactions == null || tmpFilterTransactions.Length == 0)              if (tmpFilterTransactions == null || tmpFilterTransactions.Length == 0)
111              {              {
# Line 114  namespace MQFilter Line 136  namespace MQFilter
136              catch (Exception e)              catch (Exception e)
137              {              {
138                  logFile.addSingleLogEntry("Error during transportAllMessages: " + e.Message);                  logFile.addSingleLogEntry("Error during transportAllMessages: " + e.Message);
139                    Console.WriteLine(e.StackTrace);
140              }              }
141          }          }
142    
# Line 160  namespace MQFilter Line 183  namespace MQFilter
183                          queueIndbakke.Get(mqMsg, mqGetMsgOpts);                          queueIndbakke.Get(mqMsg, mqGetMsgOpts);
184                          if (mqMsg.Format.CompareTo(MQC.MQFMT_STRING) == 0)                          if (mqMsg.Format.CompareTo(MQC.MQFMT_STRING) == 0)
185                          {                          {
186                                if (mqMsg.MessageLength == 0) //Skip empty transactions (so far only seen on my test server)
187                                    continue;
188    
189                                //System.Console.WriteLine("LEN>" + mqMsg.MessageLength);
190                              string salt2String = mqMsg.ReadString(mqMsg.MessageLength);                              string salt2String = mqMsg.ReadString(mqMsg.MessageLength);
191                              //System.Console.WriteLine(msgString);                              
192    
193    
194                              // validér at headeren er gyldig                              // validér at headeren er gyldig
# Line 200  namespace MQFilter Line 227  namespace MQFilter
227                                                            
228    
229                              messageCount++;// increment per run message counter                              messageCount++;// increment per run message counter
230                              if (messageCount >= 10000) // if we have moved  10000 messages in this run - let it go                              if (messageCount >= TRANSACTIONS_PER_RUN) // if we have moved  TRANSACTIONS_PER_RUN messages in this run - let it go
231                              {                              {
232                                  isContinue = false;                                  isContinue = false;
233                              }                              }
# Line 252  namespace MQFilter Line 279  namespace MQFilter
279          private Boolean saveForLater(Salt2Header header)          private Boolean saveForLater(Salt2Header header)
280          {          {
281    
282              DateTime now = DateTime.Now;              TimeSpan now = DateTime.Now.TimeOfDay;
283              int hour = now.Hour;              
284              if (hour >= 14 && hour < 18)              if (now >= silentPeriodBegin && now < silentPeriodEnd)
285              {              {
286    
287                    if (header.afsender == "DAO") //DAO transaktioner må altid komme igennem
288                        return false;
289                                    
290                  if (contains(header.transaktionForkortelse, this.filterTranscations) ) //Så længe vi skal være .net3.0 kompatible er LINQ problematisk (LINQ kræver 3.5)                  if (contains(header.transaktionForkortelse, this.filterTranscations) ) //Så længe vi skal være .net3.0 kompatible er LINQ problematisk (LINQ kræver 3.5)
291                  {                  {

Legend:
Removed from v.2177  
changed lines
  Added in v.2183

  ViewVC Help
Powered by ViewVC 1.1.20