Beispiel #1
0
        public ActionResult <string> Update()
        {
            RmqPublishMessage found = _publishedMessageStore.GetByDeliveryTag(1);

            found.Status = MessageStatusConstants.Success;
            found.Sender = "updated sender";

            _publishedMessageStore.Update(found);

            RmqPublishMessage updated = _publishedMessageStore.GetByMessageId(found.MessageId);

            return(JsonConvert.SerializeObject(updated, Formatting.Indented));
        }
Beispiel #2
0
        public void Handler(object sender, BasicReturnEventArgs e, IPublishedMessageStore publishedMessageStore)
        {
            using (var tx = publishedMessageStore.BeginTransaction())
            {
                string body = Encoding.UTF8.GetString(e.Body);

                RmqPublishMessage returnedMessage = JsonConvert.DeserializeObject <RmqPublishMessage>(body);

                RmqPublishMessage foundMessage = publishedMessageStore.GetByMessageId(returnedMessage.MessageId);

                foundMessage.Status       = MessageStatusConstants.Unroutable;
                foundMessage.StatusReason = e.ReplyText;

                publishedMessageStore.Update(foundMessage);

                publishedMessageStore.Commit(tx);
            }
        }