Beispiel #1
0
        public QueueMessagesVisualization get_messages_Port_QueueName(MessagesInputModel input)
        {
            var request = new QueueMessageRetrievalRequest
            {
                Port      = input.Port,
                QueueName = input.QueueName
            };

            var messages = _queueMessageRetrieval.GetAllMessagesInQueue(request).Select(msg =>
            {
                var summary = new MessageSummary
                {
                    id               = msg.Id.ToString(),
                    sentat           = msg.SentAt.ToString(),
                    sourceinstanceid = msg.Id.SourceInstanceId.ToString(),
                    headers          = msg.Headers
                };

                if (msg is OutgoingMessage)
                {
                    summary.destination = msg.As <OutgoingMessage>().Destination.ToString();
                }


                return(summary);
            }).ToArray();

            return(new QueueMessagesVisualization
            {
                Port = input.Port,
                QueueName = input.QueueName,
                Messages = messages
            });
        }
        public QueueMessagesVisualization get_messages_Port_QueueName(MessagesInputModel input)
        {
            var request = new QueueMessageRetrievalRequest
            {
                Port = input.Port,
                QueueName = input.QueueName
            };

            var messages = _queueMessageRetrieval.GetAllMessagesInQueue(request).Select(msg =>
            {
                var summary = new MessageSummary
                {
                    id = msg.Id.ToString(),
                    status = msg.Status.ToString(),
                    sentat = msg.SentAt.ToString(),
                    sourceinstanceid = msg.Id.SourceInstanceId.ToString(),
                    headers = msg.Headers.ToDictionary()
                };

                if (msg is PersistentMessageToSend)
                {
                    summary.destination = msg.As<PersistentMessageToSend>().Endpoint.ToString();
                }

                return summary;
            }).ToArray();

            return new QueueMessagesVisualization
            {
                Port = input.Port,
                QueueName = input.QueueName,
                Messages = messages
            };
        }