Example #1
0
        public void Publish(Object message, Dictionary <object, object> headers, String subtopic, PublishingResponder responder, string destination)
        {
            AsyncMessage asyncMessage;

            if (message is AsyncMessage)
            {
                asyncMessage = (AsyncMessage)message;
            }
            else
            {
                asyncMessage            = new AsyncMessage();
                asyncMessage._body      = new BodyHolder();
                asyncMessage._body.body = message;
            }

            asyncMessage.destination = destination;
            asyncMessage.headers     = asyncMessage.headers ?? new Dictionary <object, object>();

            if (headers != null)
            {
                foreach (KeyValuePair <object, object> keyValuePair in headers)
                {
                    if (asyncMessage.headers.Contains(keyValuePair.Key))
                    {
                        asyncMessage.headers[keyValuePair.Key] = keyValuePair.Value;
                    }
                    else
                    {
                        asyncMessage.headers.Add(keyValuePair.Key, keyValuePair.Value);
                    }
                }
            }

            asyncMessage.messageId = Guid.NewGuid().ToString();
            //
            //          asyncMessage.clientId = IdInfo.ClientId;

            if (subtopic != null)
            {
                asyncMessage.headers["DSSubtopic"] = subtopic;
            }

            if (IdInfo.DsId != null)
            {
                asyncMessage.headers["DSId"] = IdInfo.DsId;
            }

            if (responder == null)
            {
                responder = new PublishingResponder(PublishResponseHandler, PublishErrorHandler);
            }

            _engine.SendRequest(asyncMessage, responder);
        }
Example #2
0
 public void Publish(Object message, Dictionary <object, object> headers, PublishingResponder responder)
 {
     this.Publish(message, headers, null, responder);
 }
Example #3
0
 public void Publish(Object message, Dictionary <object, object> headers, String subtopic, PublishingResponder responder)
 {
     Publish(message, headers, subtopic, responder, IdInfo.Destination);
 }
Example #4
0
 public void Publish(Object message, PublishingResponder responder)
 {
     this.Publish(message, null, null, responder);
 }