private void SendInternal(object[] msgs, Endpoint destination, Action <NameValueCollection> customizeHeaders)
        {
            var messageId          = Guid.NewGuid();
            var messageInformation = new OutgoingMessageInformation
            {
                Destination = destination,
                Messages    = msgs,
                Source      = Endpoint
            };
            var payload = messageBuilder.BuildFromMessageBatch(messageInformation);

            logger.DebugFormat("Sending a message with id '{0}' to '{1}'", messageId, destination.Uri);
            customizeHeaders(payload.Headers);

            _sqlQueueManager.Send(destination.Uri, payload);

            var copy = MessageSent;

            if (copy == null)
            {
                return;
            }

            copy(new SqlQueueCurrentMessageInformation
            {
                AllMessages = msgs,
                Source      = Endpoint.Uri,
                Destination = destination.Uri,
                MessageId   = messageId,
            });
        }
            public MessagePayload BuildFromMessageBatch(params object[] msgs)
            {
                var payload = inner.BuildFromMessageBatch(msgs);

                Contextualize(payload);
                return(payload);
            }
        private void SendInternal(object[] msgs, Endpoint destination, Action <NameValueCollection> customizeHeaders)
        {
            var messageId = Guid.NewGuid();
            var payload   = messageBuilder.BuildFromMessageBatch(msgs);

            logger.DebugFormat("Sending a message with id '{0}' to '{1}'", messageId, destination.Uri);
            customizeHeaders(payload.Headers);
            var transactionOptions = GetTransactionOptions();

            using (var tx = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
            {
                queueManager.Send(destination.Uri, payload);
                tx.Complete();
            }

            var copy = MessageSent;

            if (copy == null)
            {
                return;
            }

            copy(new RhinoQueueCurrentMessageInformation
            {
                AllMessages = msgs,
                Source      = Endpoint.Uri,
                Destination = destination.Uri,
                MessageId   = messageId,
            });
        }
Beispiel #4
0
        public void Send(params object[] msgs)
        {
            var endpoint = messageOwners.GetEndpointForMessageBatch(msgs);

            using (var queue = endpoint.InitalizeQueue())
            {
                var message = messageBuilder.BuildFromMessageBatch(msgs);
                queue.SendInSingleTransaction(message);
            }
        }
Beispiel #5
0
            public MessagePayload BuildFromMessageBatch(OutgoingMessageInformation messageInformation)
            {
                var payload = inner.BuildFromMessageBatch(messageInformation);

                Contextualize(payload);

                if (MessageBuilt != null)
                {
                    MessageBuilt(payload);
                }
                return(payload);
            }
Beispiel #6
0
        public void Send(params object[] msgs)
        {
            var endpoint           = messageOwners.GetEndpointForMessageBatch(msgs);
            var messageInformation = new OutgoingMessageInformation
            {
                Destination = endpoint,
                Messages    = msgs,
            };

            using (var queue = endpoint.InitalizeQueue())
            {
                var message = messageBuilder.BuildFromMessageBatch(messageInformation);
                queue.SendInSingleTransaction(message);
            }
        }
Beispiel #7
0
 protected Message GenerateMsmqMessageFromMessageBatch(OutgoingMessageInformation messageInformation)
 {
     return(messageBuilder.BuildFromMessageBatch(messageInformation));
 }
 protected Message GenerateMsmqMessageFromMessageBatch(params object[] msgs)
 {
     return(messageBuilder.BuildFromMessageBatch(msgs));
 }