Exemple #1
0
            protected override Message CreateWcfMessage()
            {
                string      localIdentifier;
                Transaction transaction = base.Transaction;
                SendCommand sendCommand = new SendCommand()
                {
                    Messages = MessageCollection.Wrap(this.messages),
                    Timeout  = base.RemainingTime()
                };
                SendCommand sendCommand1 = sendCommand;

                if (transaction != null)
                {
                    localIdentifier = transaction.TransactionInformation.LocalIdentifier;
                }
                else
                {
                    localIdentifier = null;
                }
                sendCommand1.TransactionId = localIdentifier;
                SendCommand sendCommand2 = sendCommand;
                RequestInfo requestInfo  = new RequestInfo()
                {
                    ServerTimeout = new TimeSpan?(sendCommand2.Timeout),
                    TransactionId = sendCommand2.TransactionId
                };
                RequestInfo requestInfo1 = requestInfo;

                this.messageSender.AddRequestInfoHeader(requestInfo1, this.messages);
                if (this.trackingContext != null)
                {
                    SbmpMessageSender.TraceSend(this.relatedActivity, this.trackingContext, this.messages);
                }
                Message message = base.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageSender/Send", sendCommand2, null, this.messageSender.RetryPolicy, this.trackingContext, requestInfo1);

                return(message);
            }
Exemple #2
0
            protected override IEnumerator <IteratorAsyncResult <SbmpMessageSender.ScheduleMessageCommandAsyncResult> .AsyncStep> GetAsyncSteps()
            {
                ScheduleMessageCommand scheduleMessageCommand = new ScheduleMessageCommand()
                {
                    Messages      = MessageCollection.Wrap(this.messages),
                    Timeout       = base.RemainingTime(),
                    TransactionId = null
                };
                ScheduleMessageCommand scheduleMessageCommand1 = scheduleMessageCommand;
                RequestInfo            requestInfo1            = new RequestInfo()
                {
                    ServerTimeout = new TimeSpan?(scheduleMessageCommand1.Timeout),
                    TransactionId = scheduleMessageCommand1.TransactionId
                };
                RequestInfo requestInfo = requestInfo1;

                this.messageSender.AddRequestInfoHeader(requestInfo, this.messages);
                if (this.trackingContext != null)
                {
                    SbmpMessageSender.TraceSend(this.relatedActivity, this.trackingContext, this.messages);
                }
                this.wcfMessage = this.messageSender.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageSender/ScheduleMessage", scheduleMessageCommand1, null, this.messageSender.RetryPolicy, this.trackingContext, requestInfo);
                SbmpMessageSender.ScheduleMessageCommandAsyncResult scheduleMessageCommandAsyncResult          = this;
                IteratorAsyncResult <SbmpMessageSender.ScheduleMessageCommandAsyncResult> .BeginCall beginCall = (SbmpMessageSender.ScheduleMessageCommandAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.messageSender.SbmpMessagingFactory.Channel.BeginRequest(thisPtr.wcfMessage, thisPtr.OriginalTimeout, c, s);
                yield return(scheduleMessageCommandAsyncResult.CallAsync(beginCall, (SbmpMessageSender.ScheduleMessageCommandAsyncResult thisPtr, IAsyncResult a) => thisPtr.response = thisPtr.messageSender.SbmpMessagingFactory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer));

                ScheduleMessageResponseCommand body = this.response.GetBody <ScheduleMessageResponseCommand>();

                if (body.SequenceNumbers != null)
                {
                    foreach (long sequenceNumber in body.SequenceNumbers)
                    {
                        this.SequenceNumbers.Add(sequenceNumber);
                    }
                }
            }