Beispiel #1
0
        protected IEnumerable <VengaMessage> GetMessagesFromEndpoint(Endpoint endpoint, int messageCount)
        {
            var brokeredMessagesList = MessageServices.GetMessagesFromEndpoint(endpoint, messageCount);
            var messagesToReturn     = new List <VengaMessage>();

            foreach (var message in brokeredMessagesList)
            {
                messagesToReturn.Add(VengaMessage.FromBrokeredMessage(message));
            }
            return(messagesToReturn);
        }
        public static BrokeredMessage ToBrokeredMessage(VengaMessage vengaMessage)
        {
            var message = new BrokeredMessage(vengaMessage.MessageBody);

            //set predefined properties
            foreach (var property in vengaMessage.PredefinedProperties)
            {
                MessageProperties.SetProperty(message, property.Key, property.Value);
            }
            //set custom properties
            foreach (var property in vengaMessage.CustomProperties)
            {
                message.Properties.Add(property.Key, property.Value);
            }
            return(message);
        }
Beispiel #3
0
        protected void SendMessageToEndpoint(Endpoint endpoint, VengaMessage message)
        {
            var brokeredMessage = message.ToBrokeredMessage();

            MessageServices.SendMessageToEndpoint(endpoint, brokeredMessage);
        }
 public void SendMessageToSubscription(string topicName, string subscriptionName, [FromBody] VengaMessage message)
 {
     SendMessageToEndpoint(GetTopic(topicName), message);
 }
 public void SendMessageToTopic(string topicName, [FromBody] VengaMessage message)
 {
     SendMessageToEndpoint(GetTopic(topicName), message);
 }
 public void SendMessageToQueue(string queueName, [FromBody] VengaMessage message)
 {
     SendMessageToEndpoint(GetQueue(queueName), message);
 }