protected override IEnumerator <IteratorAsyncResult <SbmpMessageSender.CancelScheduledMessageCommandAsyncResult> .AsyncStep> GetAsyncSteps() { CancelScheduledMessageCommand cancelScheduledMessageCommand = new CancelScheduledMessageCommand() { SequenceNumbers = this.sequenceNumbers, Timeout = base.RemainingTime(), TransactionId = null }; CancelScheduledMessageCommand cancelScheduledMessageCommand1 = cancelScheduledMessageCommand; RequestInfo requestInfo1 = new RequestInfo() { ServerTimeout = new TimeSpan?(cancelScheduledMessageCommand1.Timeout), TransactionId = cancelScheduledMessageCommand1.TransactionId }; RequestInfo nullable = requestInfo1; nullable.SequenceNumber = new long?(this.sequenceNumbers.First <long>()); if (this.trackingContext != null) { SbmpMessageSender.TraceCancel(this.relatedActivity, this.trackingContext, this.sequenceNumbers); } this.wcfMessage = this.messageSender.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageSender/CancelScheduledMessage", cancelScheduledMessageCommand1, null, this.messageSender.RetryPolicy, this.trackingContext, nullable); SbmpMessageSender.CancelScheduledMessageCommandAsyncResult cancelScheduledMessageCommandAsyncResult = this; IteratorAsyncResult <SbmpMessageSender.CancelScheduledMessageCommandAsyncResult> .BeginCall beginCall = (SbmpMessageSender.CancelScheduledMessageCommandAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.messageSender.SbmpMessagingFactory.Channel.BeginRequest(thisPtr.wcfMessage, thisPtr.OriginalTimeout, c, s); yield return(cancelScheduledMessageCommandAsyncResult.CallAsync(beginCall, (SbmpMessageSender.CancelScheduledMessageCommandAsyncResult thisPtr, IAsyncResult r) => thisPtr.messageSender.SbmpMessagingFactory.Channel.EndRequest(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); }
private CreateSenderLinkSettings(SbmpMessagingFactory messagingFactory, string entityName, MessagingEntityType?entityType, string transferDestinationEntityName, RetryPolicy retryPolicy) { SbmpMessagingFactory sbmpMessagingFactory = messagingFactory; string str = entityName; string str1 = entityName; Microsoft.ServiceBus.Messaging.Sbmp.LinkInfo linkInfo = new Microsoft.ServiceBus.Messaging.Sbmp.LinkInfo() { LinkId = messagingFactory.GetNextLinkId(), ConnectionId = messagingFactory.ConnectionId, LinkType = LinkType.Send, EntityName = entityName, EntityType = entityType }; Microsoft.ServiceBus.Messaging.Sbmp.LinkInfo linkInfo1 = linkInfo; if (string.IsNullOrEmpty(transferDestinationEntityName)) { string str2 = null; } else { str2 = messagingFactory.CreateUri(transferDestinationEntityName).ToString(); } linkInfo1.TransferDestinationEntityAddress = str2; base(sbmpMessagingFactory, str, str1, linkInfo, null); this.MessageSender = new SbmpMessageSender(base.EntityName, base.MessagingFactory, base.MessageCreator, retryPolicy); }
public SendCommandAsyncResult(SbmpMessageSender messageSender, TrackingContext trackingContext, IEnumerable <BrokeredMessage> messages, TimeSpan timeout, AsyncCallback callback, object state) : base(messageSender.SbmpMessagingFactory, messageSender.MessageCreator, null, timeout, callback, state) { this.messageSender = messageSender; this.trackingContext = trackingContext; this.messages = messages; this.relatedActivity = EventTraceActivity.CreateFromThread(); base.Start(); }
public CancelScheduledMessageCommandAsyncResult(SbmpMessageSender messageSender, TrackingContext trackingContext, IEnumerable <long> sequenceNumbers, TimeSpan timeout, AsyncCallback callback, object state) : base(timeout, callback, state) { this.messageSender = messageSender; this.trackingContext = trackingContext; this.sequenceNumbers = sequenceNumbers; this.relatedActivity = EventTraceActivity.CreateFromThread(); base.Start(); }
private static void TraceSend(EventTraceActivity fromActivity, TrackingContext requestTracker, IEnumerable <BrokeredMessage> messages) { if (fromActivity != null && fromActivity != EventTraceActivity.Empty) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.MessageSendingTransfer(fromActivity, requestTracker.Activity)); } SbmpMessageSender.GetFormattedMessageId(messages); MessagingClientEtwProvider.TraceClient(() => { }); }
private static void TraceCancel(EventTraceActivity fromActivity, TrackingContext requestTracker, IEnumerable <long> sequenceNumbers) { if (fromActivity != null && fromActivity != EventTraceActivity.Empty) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.MessageSendingTransfer(fromActivity, requestTracker.Activity)); } SbmpMessageSender.GetFormattedSequenceNumbers(sequenceNumbers); MessagingClientEtwProvider.TraceClient(() => { }); }
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); }
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); } } }