bool testMessage(GxQueueMessage gxm) { if (QueryString.Trim().Length == 0) { return(true); } Regex r = new Regex(@"\s*(?<ptyName>\S+)\s*(?<oper>[=><!][=>]{0,1})\s*(?<ptyVal>\S+);{0,1}"); Match m = r.Match(QueryString); bool result = true; while (m.Success) { result = false; // have to match all the query conditions for (int i = 0; i < gxm.Properties.Count; i++) { if (m.Groups["ptyName"].Value.Trim() == gxm.Properties.GetKey(i).Trim()) { if (!testCondition(gxm.Properties.Get(gxm.Properties.GetKey(i)).Trim(), m.Groups["oper"].Value.Trim(), m.Groups["ptyVal"].Value.Trim())) { return(false); } else { result = true; } break; } } m = m.NextMatch(); } return(result); }
public string Send(GxQueueMessage msg) { Message m = msg.GetBaseMessage(this.propertyFilter); try { if (mq == null) { errCode = 1; errDescription = "Send message error: connection to the queue is closed"; GXLogging.Debug(log, errDescription); return(""); } if (transactional(mq) && context.MQTransaction != null) { if (context.MQTransaction.Status != MessageQueueTransactionStatus.Pending) { context.MQTransaction.Begin(); } GXLogging.Debug(log, "Sending message to transactional queue:" + mq.Path); mq.Send(m, context.MQTransaction); } else { GXLogging.Debug(log, "Sending message to non transactional queue:" + mq.Path); mq.Send(m); } msg.SetBaseMessage(m); } catch (MessageQueueException mex) { errCode = 1; errDescription = mex.Message; GXLogging.Debug(log, "Send message error code:" + mex.MessageQueueErrorCode + ", msmq path:" + mq.Path, mex); return(""); } catch (Exception ex) { errCode = 1; errDescription = ex.Message; GXLogging.Debug(log, "Send message error, msmq path:" + mq.Path, ex); return(""); } return(m.Id); }
public GxQueueMessage GetNext() { GxQueueMessage gxm = new GxQueueMessage(); bool messageExist = false; bool validMessage = false; while (!validMessage) { try { messageExist = mEnum.MoveNext(); if (messageExist) { Message m = (Message)(mEnum.Current); gxm.SetBaseMessage(m); validMessage = testMessage(gxm); if (validMessage && !browse) { mEnum.RemoveCurrent(); } } else { validMessage = true; } } catch (MessageQueueException mex) { errCode = 1; errDescription = mex.Message; messageExist = false; validMessage = true; } } mEof = !messageExist; return(gxm); }