/// <summary> /// Sends HMQ message to client /// </summary> public virtual bool Send(HorseMessage message, IList <KeyValuePair <string, string> > additionalHeaders = null) { if (UseUniqueMessageId && string.IsNullOrEmpty(message.MessageId)) { message.SetMessageId(_uniqueIdGenerator.Create()); } byte[] data = HmqWriter.Create(message, additionalHeaders); return(Send(data)); }
/// <summary> /// Sends TMQ message to client /// </summary> public bool Send(TmqMessage message) { if (UseUniqueMessageId && string.IsNullOrEmpty(message.MessageId)) { message.SetMessageId(_uniqueIdGenerator.Create()); } byte[] data = _writer.Create(message).Result; return(Send(data)); }
private Task <bool> SendDistribute(HorseMessage message) { bool sent = false; foreach (HorseQueue queue in _queues) { string messageId = sent || Interaction == BindingInteraction.None ? message.MessageId : _idGenerator.Create(); if (!sent) { sent = true; } HorseMessage msg = message.Clone(true, true, messageId); QueueMessage queueMessage = new QueueMessage(msg); queue.AddMessage(queueMessage); } return(Task.FromResult(sent)); }