Esempio n. 1
0
        protected MongoMessageWrapper Wrap(MessageContainer mc)
        {
            var mw = new MongoMessageWrapper
            {
                From       = string.IsNullOrEmpty(mc.From) ? this.Endpoint : mc.From,
                To         = mc.To,
                InsertTime = DateTime.Now,
                RetryCount = 0,
                RetryTime  = mc.DeliverAt,
                SubQueue   = "I",
                Payload    = mc.BodyStr
            };
            var hl = MongoMessageWrapper.GetSkipHeaderNames();

            if (mc.Headers != null && mc.Headers.Any(x => !hl.Contains(x.Key)))
            {
                mw.Headers = new Dictionary <string, string>();
                foreach (string k in mc.Headers.Keys)
                {
                    if (!hl.Contains(k))
                    {
                        mw.Headers[k] = mc.Headers[k];
                    }
                }
            }

            return(mw);
        }
Esempio n. 2
0
        protected MessageContainer Unwrap(MongoMessageWrapper m)
        {
            var mc = new MessageContainer();

            mc.Headers = new Dictionary <string, string>();
            if (m.Headers != null)
            {
                foreach (string s in m.Headers.Keys)
                {
                    mc.SetHeader(s, m.Headers[s]);
                }
            }

            mc.BodyStr      = m.Payload;
            mc.BusMessageId = m._id.ToString();
            mc.RetryCount   = m.RetryCount;
            mc.From         = m.From;
            mc.To           = m.To;

            return(mc);
        }
Esempio n. 3
0
 protected void SendToMongoDatabase(string endpoint, MongoMessageWrapper mw)
 {
     throw new NotImplementedException();
 }
        protected MongoMessageWrapper Wrap(MessageContainer mc)
        {
            var mw = new MongoMessageWrapper
            {
                From = string.IsNullOrEmpty(mc.From) ? this.Endpoint : mc.From,
                To = mc.To,
                InsertTime = DateTime.Now,
                RetryCount = 0,
                RetryTime = mc.DeliverAt,
                SubQueue = "I",
                Payload = mc.BodyStr
            };
            var hl = MongoMessageWrapper.GetSkipHeaderNames();
            if (mc.Headers != null && mc.Headers.Any(x => !hl.Contains(x.Key)))
            {
                mw.Headers = new Dictionary<string, string>();
                foreach (string k in mc.Headers.Keys)
                {
                    if (!hl.Contains(k)) mw.Headers[k] = mc.Headers[k];
                }
            }

            return mw;
        }
        protected MessageContainer Unwrap(MongoMessageWrapper m)
        {
            var mc = new MessageContainer();
            mc.Headers = new Dictionary<string, string>();
            if (m.Headers != null)
            {
                foreach (string s in m.Headers.Keys)
                {
                    mc.SetHeader(s, m.Headers[s]);
                }
            }

            mc.BodyStr = m.Payload;
            mc.BusMessageId = m._id.ToString();
            mc.RetryCount = m.RetryCount;
            mc.From = m.From;
            mc.To = m.To;

            return mc;
        }
 protected void SendToMongoDatabase(string endpoint, MongoMessageWrapper mw)
 {
     throw new NotImplementedException();
 }