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); } }
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); } }