protected override IEnumerator <IteratorAsyncResult <CloseOrAbortLinkAsyncResult> .AsyncStep> GetAsyncSteps() { Exception exception; if (this.batchManager != null) { if (!this.aborting) { CloseOrAbortLinkAsyncResult closeOrAbortLinkAsyncResult = this; IteratorAsyncResult <CloseOrAbortLinkAsyncResult> .BeginCall beginCall = (CloseOrAbortLinkAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.batchManager.BeginClose(t, c, s); IteratorAsyncResult <CloseOrAbortLinkAsyncResult> .EndCall endCall = (CloseOrAbortLinkAsyncResult thisPtr, IAsyncResult a) => thisPtr.batchManager.EndClose(a); yield return(closeOrAbortLinkAsyncResult.CallAsync(beginCall, endCall, (CloseOrAbortLinkAsyncResult thisPtr, TimeSpan t) => thisPtr.batchManager.Close(t), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); } else { this.batchManager.Abort(); } } try { RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(SbmpProtocolDefaults.BufferTimeout(base.RemainingTime(), true)) }; RequestInfo requestInfo1 = requestInfo; this.closeMessage = this.linkMessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpConnection/CloseLink", new CloseLinkCommand(), this.parentLinkId, null, null, requestInfo1); } catch (Exception exception2) { Exception exception1 = exception2; if (Fx.IsFatal(exception1)) { throw; } CloseOrAbortLinkAsyncResult closeOrAbortLinkAsyncResult1 = this; if (this.aborting) { exception = null; } else { exception = exception1; } closeOrAbortLinkAsyncResult1.Complete(exception); goto Label0; } IteratorAsyncResult <CloseOrAbortLinkAsyncResult> .ExceptionPolicy exceptionPolicy = (this.aborting ? IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue : IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer); CloseOrAbortLinkAsyncResult closeOrAbortLinkAsyncResult2 = this; IteratorAsyncResult <CloseOrAbortLinkAsyncResult> .BeginCall beginCall1 = (CloseOrAbortLinkAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.channel.BeginRequest(thisPtr.closeMessage, SbmpProtocolDefaults.BufferTimeout(t, true), c, s); yield return(closeOrAbortLinkAsyncResult2.CallAsync(beginCall1, (CloseOrAbortLinkAsyncResult thisPtr, IAsyncResult a) => thisPtr.channel.EndRequest(a), (IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy)exceptionPolicy)); Label0: yield break; }
protected override IEnumerator <IteratorAsyncResult <SbmpBrowsableMessageSession.PeekMessagesAsyncResult> .AsyncStep> GetAsyncSteps() { object obj = null; if (this.sbmpMessageSession.InnerMessageReceiver == null) { bool flag = false; try { object thisLock = this.sbmpMessageSession.ThisLock; object obj1 = thisLock; obj = thisLock; Monitor.Enter(obj1, ref flag); this.sbmpMessageSession.resetEvent.WaitOne(); } finally { if (flag) { Monitor.Exit(obj); } } try { if (this.sbmpMessageSession.InnerMessageReceiver != null) { goto Label0; } SbmpBrowsableMessageSession.PeekMessagesAsyncResult peekMessagesAsyncResult = this; IteratorAsyncResult <SbmpBrowsableMessageSession.PeekMessagesAsyncResult> .BeginCall beginCall = (SbmpBrowsableMessageSession.PeekMessagesAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.BeginAcceptMessageSessionBrowser(t, c, s); yield return(peekMessagesAsyncResult.CallAsync(beginCall, (SbmpBrowsableMessageSession.PeekMessagesAsyncResult thisPtr, IAsyncResult r) => thisPtr.EndAcceptMessageSessionBrowser(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); } finally { this.sbmpMessageSession.resetEvent.Set(); } } Label0: if (this.sbmpMessageSession.InnerMessageReceiver != null) { SbmpBrowsableMessageSession.PeekMessagesAsyncResult peekMessagesAsyncResult1 = this; IteratorAsyncResult <SbmpBrowsableMessageSession.PeekMessagesAsyncResult> .BeginCall beginCall1 = (SbmpBrowsableMessageSession.PeekMessagesAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.sbmpMessageSession.InnerMessageReceiver.BeginPeekBatch(thisPtr.trackingContext, thisPtr.fromSequenceNumber, thisPtr.messageCount, SbmpProtocolDefaults.BufferTimeout(t, thisPtr.sbmpMessageSession.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), c, s); yield return(peekMessagesAsyncResult1.CallAsync(beginCall1, (SbmpBrowsableMessageSession.PeekMessagesAsyncResult thisPtr, IAsyncResult a) => thisPtr.Messages = thisPtr.sbmpMessageSession.InnerMessageReceiver.EndPeekBatch(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); } }
protected override IEnumerator <IteratorAsyncResult <SbmpBrowsableMessageSession.GetStateAsyncResult> .AsyncStep> GetAsyncSteps() { object obj = null; bool flag = false; if (this.sbmpMessageSession.InnerMessageReceiver == null) { bool flag1 = false; try { object thisLock = this.sbmpMessageSession.ThisLock; object obj1 = thisLock; obj = thisLock; Monitor.Enter(obj1, ref flag1); this.sbmpMessageSession.resetEvent.WaitOne(); } finally { if (flag1) { Monitor.Exit(obj); } } try { if (this.sbmpMessageSession.InnerMessageReceiver != null) { goto Label0; } flag = true; SbmpBrowsableMessageSession.GetStateAsyncResult getStateAsyncResult = this; IteratorAsyncResult <SbmpBrowsableMessageSession.GetStateAsyncResult> .BeginCall beginCall = (SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.BeginAcceptMessageSessionBrowser(t, c, s); yield return(getStateAsyncResult.CallAsync(beginCall, (SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, IAsyncResult r) => thisPtr.EndAcceptMessageSessionBrowser(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); } finally { this.sbmpMessageSession.resetEvent.Set(); } } Label0: if (this.sbmpMessageSession.InnerMessageReceiver != null && !flag) { GetSessionStateCommand getSessionStateCommand = new GetSessionStateCommand() { SessionId = this.sbmpMessageSession.SessionId, Timeout = base.RemainingTime(), TransactionId = null, IsBrowseMode = true }; GetSessionStateCommand getSessionStateCommand1 = getSessionStateCommand; RequestInfo requestInfo1 = new RequestInfo() { ServerTimeout = new TimeSpan?(getSessionStateCommand1.Timeout) }; RequestInfo requestInfo = requestInfo1; SbmpMessageReceiver innerMessageReceiver = (SbmpMessageReceiver)this.sbmpMessageSession.InnerMessageReceiver; this.wcfMessage = innerMessageReceiver.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/GetSessionState", getSessionStateCommand1, null, this.sbmpMessageSession.RetryPolicy, this.trackingContext, requestInfo); yield return(base.CallAsync((SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => innerMessageReceiver.SbmpMessagingFactory.Channel.BeginRequest(thisPtr.wcfMessage, SbmpProtocolDefaults.BufferTimeout(t, innerMessageReceiver.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), c, s), (SbmpBrowsableMessageSession.GetStateAsyncResult thisPtr, IAsyncResult a) => thisPtr.Response = innerMessageReceiver.SbmpMessagingFactory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); if (base.LastAsyncStepException == null) { this.SessionState = this.Response.GetBody <GetSessionStateResponseCommand>().SessionState; } } }
public AcceptMessageSessionAsyncResult(SbmpMessagingFactory messagingFactory, string entityName, string sessionId, MessagingEntityType?entityType, ReceiveMode receiveMode, int prefetchCount, Lazy <SbmpMessageCreator> controlMessageCreator, RetryPolicy retryPolicy, TimeSpan serverWaitTime, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.prefetchCount = prefetchCount; this.sessionId = sessionId; this.MessagingFactory = messagingFactory; this.retryPolicy = retryPolicy ?? messagingFactory.RetryPolicy.Clone(); LinkInfo linkInfo = new LinkInfo() { LinkId = messagingFactory.GetNextLinkId(), ConnectionId = messagingFactory.ConnectionId, LinkType = LinkType.Receive, IsSessionReceiver = true, ReceiveMode = receiveMode, EntityName = entityName, EntityType = entityType }; this.createLinkSettings = new CreateLinkSettings(messagingFactory, entityName, entityName, linkInfo, controlMessageCreator); AcceptMessageSessionCommand acceptMessageSessionCommand = new AcceptMessageSessionCommand() { SessionId = this.sessionId, Timeout = serverWaitTime, OperationTimeout = timeout, PrefetchCount = this.prefetchCount }; AcceptMessageSessionCommand acceptMessageSessionCommand1 = acceptMessageSessionCommand; string linkId = null; if (this.createLinkSettings.ControlMessageCreator != null && !string.IsNullOrWhiteSpace(this.createLinkSettings.ControlMessageCreator.Value.LinkInfo.LinkId)) { linkId = this.createLinkSettings.ControlMessageCreator.Value.LinkInfo.LinkId; } RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(acceptMessageSessionCommand1.Timeout), SessionId = acceptMessageSessionCommand1.SessionId }; RequestInfo requestInfo1 = requestInfo; Message message = this.createLinkSettings.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/AcceptMessageSession", acceptMessageSessionCommand1, linkId, this.retryPolicy, null, requestInfo1); if (base.SyncContinue(this.MessagingFactory.Channel.BeginRequest(message, SbmpProtocolDefaults.BufferTimeout(timeout, this.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), base.PrepareAsyncCompletion(AcceptMessageSessionAsyncResult.operationComplete), this))) { base.Complete(true); } }
protected override IEnumerator <IteratorAsyncResult <SbmpMessagingFactory.OpenAsyncResult> .AsyncStep> GetAsyncSteps() { if (this.factory.ShouldIntialize) { SbmpMessagingFactory.OpenAsyncResult openAsyncResult = this; IteratorAsyncResult <SbmpMessagingFactory.OpenAsyncResult> .BeginCall beginCall = (SbmpMessagingFactory.OpenAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => Microsoft.ServiceBus.Messaging.NetworkDetector.BeginCheckTcp(thisPtr.factory.baseAddresses, SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout), c, s); yield return(openAsyncResult.CallAsync(beginCall, (SbmpMessagingFactory.OpenAsyncResult thisPtr, IAsyncResult r) => thisPtr.factory.Initialize(!Microsoft.ServiceBus.Messaging.NetworkDetector.EndCheckTcp(r), true, thisPtr.factory.baseAddresses), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); } SbmpMessagingFactory.OpenAsyncResult openAsyncResult1 = this; IteratorAsyncResult <SbmpMessagingFactory.OpenAsyncResult> .BeginCall beginCall1 = (SbmpMessagingFactory.OpenAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.ChannelFactory.BeginOpen(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout), c, s); IteratorAsyncResult <SbmpMessagingFactory.OpenAsyncResult> .EndCall endCall = (SbmpMessagingFactory.OpenAsyncResult thisPtr, IAsyncResult r) => thisPtr.factory.ChannelFactory.EndOpen(r); yield return(openAsyncResult1.CallAsync(beginCall1, endCall, (SbmpMessagingFactory.OpenAsyncResult thisPtr, TimeSpan t) => thisPtr.factory.ChannelFactory.Open(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout)), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); if (this.ContinueAfterCommunicationException(base.LastAsyncStepException)) { EndpointAddress endpointAddress = this.factory.CreateEndpointAddress(string.Empty); this.factory.Channel = this.factory.ChannelFactory.CreateChannel(endpointAddress); SbmpMessagingFactory.OpenAsyncResult openAsyncResult2 = this; IteratorAsyncResult <SbmpMessagingFactory.OpenAsyncResult> .BeginCall beginCall2 = (SbmpMessagingFactory.OpenAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.Channel.BeginOpen(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout), c, s); IteratorAsyncResult <SbmpMessagingFactory.OpenAsyncResult> .EndCall endCall1 = (SbmpMessagingFactory.OpenAsyncResult thisPtr, IAsyncResult r) => thisPtr.factory.Channel.EndOpen(r); yield return(openAsyncResult2.CallAsync(beginCall2, endCall1, (SbmpMessagingFactory.OpenAsyncResult thisPtr, TimeSpan t) => thisPtr.factory.Channel.Open(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout)), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); this.ContinueAfterCommunicationException(base.LastAsyncStepException); } }
protected override IEnumerator <IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .AsyncStep> GetAsyncSteps() { SbmpMessagingFactory.CloseAsyncResult closeAsyncResult = this; IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .BeginCall beginCall = (SbmpMessagingFactory.CloseAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.BaseOnBeginClose(t, c, s); IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .EndCall endCall = (SbmpMessagingFactory.CloseAsyncResult thisPtr, IAsyncResult r) => thisPtr.factory.BaseOnEndClose(r); yield return(closeAsyncResult.CallAsync(beginCall, endCall, (SbmpMessagingFactory.CloseAsyncResult thisPtr, TimeSpan t) => thisPtr.factory.BaseClose(t), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); if (this.ContinueAfterCommunicationException(base.LastAsyncStepException)) { if (this.channel != null) { SbmpMessagingFactory.CloseAsyncResult closeAsyncResult1 = this; IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .BeginCall beginCall1 = (SbmpMessagingFactory.CloseAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.channel.BeginClose(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout), c, s); IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .EndCall endCall1 = (SbmpMessagingFactory.CloseAsyncResult thisPtr, IAsyncResult r) => thisPtr.channel.EndClose(r); yield return(closeAsyncResult1.CallAsync(beginCall1, endCall1, (SbmpMessagingFactory.CloseAsyncResult thisPtr, TimeSpan t) => thisPtr.channel.Close(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout)), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); if (!this.ContinueAfterCommunicationException(base.LastAsyncStepException)) { goto Label0; } } if (this.factory.ChannelFactory != null) { SbmpMessagingFactory.CloseAsyncResult closeAsyncResult2 = this; IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .BeginCall beginCall2 = (SbmpMessagingFactory.CloseAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.ChannelFactory.BeginClose(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout), c, s); IteratorAsyncResult <SbmpMessagingFactory.CloseAsyncResult> .EndCall endCall2 = (SbmpMessagingFactory.CloseAsyncResult thisPtr, IAsyncResult r) => thisPtr.factory.ChannelFactory.EndClose(r); yield return(closeAsyncResult2.CallAsync(beginCall2, endCall2, (SbmpMessagingFactory.CloseAsyncResult thisPtr, TimeSpan t) => thisPtr.factory.ChannelFactory.Close(SbmpProtocolDefaults.BufferTimeout(t, thisPtr.factory.GetSettings().EnableAdditionalClientTimeout)), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); } this.ContinueAfterCommunicationException(base.LastAsyncStepException); } Label0: yield break; }
protected override IEnumerator <IteratorAsyncResult <SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult> .AsyncStep> GetAsyncSteps() { CreateTransactionCommand createTransactionCommand = new CreateTransactionCommand() { TransactionId = this.owner.transactionId, Timeout = base.RemainingTime() }; RequestInfo nullable = this.owner.RequestInfo.Clone(); nullable.ServerTimeout = new TimeSpan?(createTransactionCommand.Timeout); nullable.TransactionId = createTransactionCommand.TransactionId; this.request = this.owner.messageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpConnection/CreateTransaction", createTransactionCommand, nullable); SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult createInstanceAsyncResult = this; IteratorAsyncResult <SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult> .BeginCall beginCall = (SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.owner.channel.BeginRequest(thisPtr.request, SbmpProtocolDefaults.BufferTimeout(t, thisPtr.owner.messageCreator.DisableClientOperationTimeBuffer), c, s); yield return(createInstanceAsyncResult.CallAsync(beginCall, (SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult thisPtr, IAsyncResult r) => thisPtr.response = thisPtr.owner.channel.EndRequest(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); if (this.response.IsFault) { base.Complete(new MessagingException(this.response.ToString())); } }
public void Start() { lock (this.transactionEnlistment.resourceManager.syncRoot) { this.transactionEnlistment.resourceManager.enlistmentMap.Remove(this.transactionEnlistment.transactionId); } try { CompleteTransactionCommand completeTransactionCommand = new CompleteTransactionCommand() { TransactionId = this.transactionEnlistment.transactionId, Timeout = SbmpResourceManager.TransactionEnlistment.rollbackTimeout, Commit = this.commit }; RequestInfo nullable = this.transactionEnlistment.RequestInfo.Clone(); nullable.ServerTimeout = new TimeSpan?(completeTransactionCommand.Timeout); nullable.TransactionId = completeTransactionCommand.TransactionId; Message message = this.transactionEnlistment.messageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpConnection/CompleteTransaction", completeTransactionCommand, nullable); WorkUnitInfo.AddTo(message.Headers, "TxnWorkUnit", completeTransactionCommand.TransactionId, this.transactionEnlistment.GetNextSequenceNumber()); IAsyncResult asyncResult = this.transactionEnlistment.channel.BeginRequest(message, SbmpProtocolDefaults.BufferTimeout(SbmpResourceManager.TransactionEnlistment.rollbackTimeout, this.transactionEnlistment.messageCreator.DisableClientOperationTimeBuffer), SbmpResourceManager.TransactionEnlistment.CompleteTransactionHelper.operationCallback, this); if (asyncResult.CompletedSynchronously) { this.OperationComplete(asyncResult); } } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } this.OnError(exception); } }
protected override IEnumerator <IteratorAsyncResult <GetMessageSessionsAsyncResult> .AsyncStep> GetAsyncSteps() { Message message = null; do { Message message1 = this.CreateRequestMessage(); GetMessageSessionsAsyncResult getMessageSessionsAsyncResult = this; IteratorAsyncResult <GetMessageSessionsAsyncResult> .BeginCall beginCall = (GetMessageSessionsAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.MessagingFactory.Channel.BeginRequest(message1, SbmpProtocolDefaults.BufferTimeout(t, thisPtr.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), c, s); yield return(getMessageSessionsAsyncResult.CallAsync(beginCall, (GetMessageSessionsAsyncResult thisPtr, IAsyncResult r) => message = thisPtr.MessagingFactory.Channel.EndRequest(r), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); }while (base.LastAsyncStepException == null && message != null && this.ShouldContinue(message)); base.Complete(base.LastAsyncStepException); }
protected override IEnumerator <IteratorAsyncResult <TIteratorAsyncResult> .AsyncStep> GetAsyncSteps() { if (this.Transaction == null) { this.wcfMessage = this.CreateWcfMessage(); } else { SbmpMessageCreator sbmpMessageCreator1 = (this.controlMessageCreator == null ? this.MessageCreator : this.controlMessageCreator.Value); SbmpTransactionalAsyncResult <TIteratorAsyncResult> sbmpTransactionalAsyncResult = this; IteratorAsyncResult <TIteratorAsyncResult> .BeginCall beginCall = (TIteratorAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => { SbmpResourceManager resourceManager = thisPtr.messagingFactory.ResourceManager; System.Transactions.Transaction transaction = thisPtr.Transaction; IRequestSessionChannel requestSessionChannel = thisPtr.channel; SbmpMessageCreator sbmpMessageCreator = sbmpMessageCreator1; object obj = thisPtr; return(resourceManager.BeginEnlist(transaction, requestSessionChannel, sbmpMessageCreator, new Action <RequestInfo>(obj.PartitionInfoSetter), t, c, s)); }; yield return(sbmpTransactionalAsyncResult.CallAsync(beginCall, (TIteratorAsyncResult thisPtr, IAsyncResult a) => thisPtr.txnSeqNumber = thisPtr.messagingFactory.ResourceManager.EndEnlist(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); this.wcfMessage = this.CreateWcfMessage(); WorkUnitInfo.AddTo(this.wcfMessage.Headers, "TxnWorkUnit", this.Transaction.TransactionInformation.LocalIdentifier, this.txnSeqNumber); } SbmpTransactionalAsyncResult <TIteratorAsyncResult> sbmpTransactionalAsyncResult1 = this; IteratorAsyncResult <TIteratorAsyncResult> .BeginCall beginCall1 = (TIteratorAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.channel.BeginRequest(thisPtr.wcfMessage, SbmpProtocolDefaults.BufferTimeout(t, this.messagingFactory.GetSettings().EnableAdditionalClientTimeout), c, s); yield return(sbmpTransactionalAsyncResult1.CallAsync(beginCall1, (TIteratorAsyncResult thisPtr, IAsyncResult a) => thisPtr.Response = thisPtr.channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); }
private IAsyncResult BeginPeekCommand(TrackingContext trackingContext, long fromSequenceNumber, int messageCount, TimeSpan timeout, AsyncCallback callback, object state) { IAsyncResult asyncResult; try { PeekCommand peekCommand = new PeekCommand() { FromSequenceNumber = fromSequenceNumber, MessageCount = messageCount, Timeout = timeout, MessageVersion = BrokeredMessage.MessageVersion }; PeekCommand peekCommand1 = peekCommand; RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(peekCommand1.Timeout), SequenceNumber = new long?(peekCommand1.FromSequenceNumber), MessageCount = new int?(peekCommand1.MessageCount) }; RequestInfo requestInfo1 = requestInfo; Message message = this.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageBrowser/Peek", peekCommand1, null, base.RetryPolicy, trackingContext, requestInfo1); asyncResult = this.SbmpMessagingFactory.Channel.BeginRequest(message, SbmpProtocolDefaults.BufferTimeout(timeout, this.SbmpMessagingFactory.GetSettings().EnableAdditionalClientTimeout), callback, state); } catch (CommunicationException communicationException1) { CommunicationException communicationException = communicationException1; throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsError(MessagingExceptionHelper.Unwrap(communicationException, base.IsClosedOrClosing), null); } catch (Exception exception1) { Exception exception = exception1; if (!Fx.IsFatal(exception) && base.IsClosedOrClosing) { throw new OperationCanceledException(SRClient.EntityClosedOrAborted, exception); } throw; } return(asyncResult); }
public AcceptMessageSessionBrowserAsyncResult(SbmpBrowsableMessageSession messageSession, SbmpMessagingFactory messagingFactory, MessagingEntityType?entityType, ReceiveMode receiveMode, int prefetchCount, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.messageSession = messageSession; this.sessionId = messageSession.SessionId; this.MessagingFactory = messagingFactory; string path = messageSession.Path; LinkInfo linkInfo = new LinkInfo() { LinkId = messagingFactory.GetNextLinkId(), ConnectionId = messagingFactory.ConnectionId, LinkType = LinkType.Receive, IsSessionReceiver = true, ReceiveMode = receiveMode, EntityName = path, EntityType = entityType, SessionId = messageSession.SessionId }; this.createLinkSettings = new CreateLinkSettings(messagingFactory, path, path, linkInfo, null); AcceptMessageSessionCommand acceptMessageSessionCommand = new AcceptMessageSessionCommand() { SessionId = this.sessionId, Timeout = timeout, PrefetchCount = prefetchCount, IsSessionBrowser = true }; AcceptMessageSessionCommand acceptMessageSessionCommand1 = acceptMessageSessionCommand; RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(acceptMessageSessionCommand1.Timeout), SessionId = acceptMessageSessionCommand1.SessionId }; RequestInfo requestInfo1 = requestInfo; Message message = this.createLinkSettings.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/AcceptMessageSession", acceptMessageSessionCommand1, null, this.messageSession.RetryPolicy, null, requestInfo1); if (base.SyncContinue(this.MessagingFactory.Channel.BeginRequest(message, SbmpProtocolDefaults.BufferTimeout(timeout, this.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), base.PrepareAsyncCompletion(AcceptMessageSessionBrowserAsyncResult.operationComplete), this))) { base.Complete(true); } }
public AcceptMessageSessionForNamespaceAsyncResult(SbmpMessagingFactory messagingFactory, ReceiveMode receiveMode, int prefetchCount, CreateControlLinkSettings controlLinkSettings, TimeSpan serverWaitTime, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.MessagingFactory = messagingFactory; this.controlLinkSettings = controlLinkSettings; this.receiveMode = receiveMode; AcceptMessageSessionForNamespaceCommand acceptMessageSessionForNamespaceCommand = new AcceptMessageSessionForNamespaceCommand() { PrefetchCount = prefetchCount, ReceiveMode = receiveMode, Timeout = serverWaitTime, OperationTimeout = timeout }; AcceptMessageSessionForNamespaceCommand acceptMessageSessionForNamespaceCommand1 = acceptMessageSessionForNamespaceCommand; RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(acceptMessageSessionForNamespaceCommand1.Timeout), OperationTimeout = new TimeSpan?(acceptMessageSessionForNamespaceCommand1.OperationTimeout) }; RequestInfo requestInfo1 = requestInfo; Message message = this.controlLinkSettings.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpConnection/AcceptMessageSessionForNamespace", acceptMessageSessionForNamespaceCommand1, null, this.MessagingFactory.RetryPolicy, null, requestInfo1); if (base.SyncContinue(this.MessagingFactory.Channel.BeginRequest(message, SbmpProtocolDefaults.BufferTimeout(timeout, this.MessagingFactory.GetSettings().EnableAdditionalClientTimeout), base.PrepareAsyncCompletion(AcceptMessageSessionForNamespaceAsyncResult.operationComplete), this))) { base.Complete(true); } }