Exemplo n.º 1
0
 public override string ToString()
 {
     return(string.Format(
                "ID:{0}, PublishTime:{1}, NextConsumeTime:{2}, ConsumedTimes:{3}, " +
                "\nTag:{4}, BodyMD5:{5}, NextConsumeTime:{6}" +
                "\nBody:{7}" +
                "\nProperties:{8}" +
                "\nMessageKey:{9}",
                Id, PublishTime, NextConsumeTime, ConsumedTimes,
                MessageTag, BodyMD5, NextConsumeTime, Body, AliyunSDKUtils.DictToString(Properties),
                MessageKey
                ));
 }
Exemplo n.º 2
0
        public TopicMessage PublishMessage(TopicMessage topicMessage)
        {
            var request = new PublishMessageRequest(topicMessage.Body, topicMessage.MessageTag);

            request.TopicName  = this._topicName;
            request.IntanceId  = this._instanceId;
            request.Properties = AliyunSDKUtils.DictToString(topicMessage.Properties);

            var marshaller   = PublishMessageRequestMarshaller.Instance;
            var unmarshaller = PublishMessageResponseUnmarshaller.Instance;

            PublishMessageResponse result = _serviceClient.Invoke <PublishMessageRequest, PublishMessageResponse>(request, marshaller, unmarshaller);

            TopicMessage retMsg = new TopicMessage(null);

            retMsg.Id            = result.MessageId;
            retMsg.BodyMD5       = result.MessageBodyMD5;
            retMsg.ReceiptHandle = result.ReeceiptHandle;

            return(retMsg);
        }