private void notifyResultError(string @ref, ResultStatus resultStatus, string errorMsg, Action<HMessage> messageDelegate) { JObject obj = new JObject(); obj["errorMsg"] = errorMsg; HResult result = new HResult(); result.SetStatus(resultStatus); result.SetResult(obj); HMessage message = new HMessage(); message.SetRef(@ref); message.SetType("hResult"); message.SetPayload(result); this.notifyMessage(message, messageDelegate); }
private HMessage InnerBuildMessage(string actor, string type, JToken payload, HMessageOptions mOptions) { if (actor == null || actor.Length <= 0) throw new MissingAttrException("actor"); HMessage message = new HMessage(); message.SetActor(actor); message.SetType(type); if (mOptions != null) { message.SetRef(mOptions.Ref); message.SetConvid(mOptions.Convid); message.SetPriority(mOptions.Priority); message.SetAuthor(mOptions.Author); message.SetHeaders(mOptions.Headers); message.SetLocation(mOptions.Location); message.SetPublished(mOptions.Published); message.SetPersistent(mOptions.Persistent); message.SetTimeout(mOptions.Timeout); if (mOptions.RelevanceOffset != null) { Debug.WriteLine("---- " + mOptions.RelevanceOffset); message.SetRelevance((DateTime.UtcNow).AddMilliseconds(mOptions.RelevanceOffset.Value)); Debug.WriteLine("++++ " + message.GetRelevance()); } else message.SetRelevance(mOptions.Relevance); } if (transportOptions != null && transportOptions.Login != null) message.SetPublisher(transportOptions.FullUrn); else message.SetPublisher(null); message.SetPayload(payload); return message; }