protected override IAsyncResult OnBeginAcceptSessionReceiver(string entityName, string sessionId, ReceiveMode receiveMode, TimeSpan timeout, AsyncCallback callback, object state)
        {
            IAsyncResult acceptMessageSessionAsyncResult;

            try
            {
                MessagingEntityType?nullable = null;
                acceptMessageSessionAsyncResult = new Microsoft.ServiceBus.Messaging.Sbmp.AcceptMessageSessionAsyncResult(this, entityName, sessionId, nullable, receiveMode, Constants.DefaultMessageSessionPrefetchCount, null, timeout, timeout, 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(acceptMessageSessionAsyncResult);
        }
        internal SessionClient(
            string clientTypeName,
            string entityPath,
            MessagingEntityType?entityType,
            ReceiveMode receiveMode,
            int prefetchCount,
            ServiceBusConnection serviceBusConnection,
            RetryPolicy retryPolicy,
            IList <ServiceBusPlugin> registeredPlugins)
            : base(clientTypeName, entityPath, retryPolicy ?? RetryPolicy.Default)
        {
            this.ServiceBusConnection = serviceBusConnection ?? throw new ArgumentNullException(nameof(serviceBusConnection));
            this.OperationTimeout     = this.ServiceBusConnection.OperationTimeout;
            this.EntityPath           = entityPath;
            this.EntityType           = entityType;
            this.ReceiveMode          = receiveMode;
            this.PrefetchCount        = prefetchCount;

            // Register plugins on the message session.
            if (registeredPlugins != null)
            {
                foreach (var serviceBusPlugin in registeredPlugins)
                {
                    this.RegisterPlugin(serviceBusPlugin);
                }
            }
        }
        protected override IAsyncResult OnBeginCreateMessageReceiver(string entityName, ReceiveMode receiveMode, TimeSpan timeout, AsyncCallback callback, object state)
        {
            MessagingEntityType?       nullable = null;
            CreateReceiverLinkSettings createReceiverLinkSetting = new CreateReceiverLinkSettings(this, entityName, entityName, nullable, receiveMode, null, false);

            return(new CompletedAsyncResult <SbmpMessageReceiver>(createReceiverLinkSetting.MessageReceiver, callback, state));
        }
예제 #4
0
 internal MessageReceiver(
     string entityPath,
     MessagingEntityType?entityType,
     ReceiveMode receiveMode,
     ServiceBusConnection serviceBusConnection,
     ICbsTokenProvider cbsTokenProvider,
     RetryPolicy retryPolicy,
     int prefetchCount      = DefaultPrefetchCount,
     string sessionId       = null,
     bool isSessionReceiver = false)
     : base(nameof(MessageReceiver) + StringUtility.GetRandomString(), retryPolicy ?? RetryPolicy.Default)
 {
     this.ReceiveMode                   = receiveMode;
     this.OperationTimeout              = serviceBusConnection.OperationTimeout;
     this.Path                          = entityPath;
     this.EntityType                    = entityType;
     this.ServiceBusConnection          = serviceBusConnection;
     this.CbsTokenProvider              = cbsTokenProvider;
     this.SessionId                     = sessionId;
     this.isSessionReceiver             = isSessionReceiver;
     this.ReceiveLinkManager            = new FaultTolerantAmqpObject <ReceivingAmqpLink>(this.CreateLinkAsync, this.CloseSession);
     this.RequestResponseLinkManager    = new FaultTolerantAmqpObject <RequestResponseAmqpLink>(this.CreateRequestResponseLinkAsync, this.CloseRequestResponseSession);
     this.requestResponseLockedMessages = new ConcurrentExpiringSet <Guid>();
     this.PrefetchCount                 = prefetchCount;
     this.messageReceivePumpSyncLock    = new object();
 }
예제 #5
0
 public void AmqpSendLinkCreateStart(string clientId, MessagingEntityType?entityType, string entityPath)
 {
     if (this.IsEnabled())
     {
         this.AmqpSendLinkCreateStart(clientId, entityType?.ToString() ?? string.Empty, entityPath);
     }
 }
        internal SessionClient(
            string clientTypeName,
            string entityPath,
            MessagingEntityType?entityType,
            ReceiveMode receiveMode,
            int prefetchCount,
            ServiceBusConnection serviceBusConnection,
            ITokenProvider tokenProvider,
            ICbsTokenProvider cbsTokenProvider,
            RetryPolicy retryPolicy,
            IList <ServiceBusPlugin> registeredPlugins)
            : base(clientTypeName, entityPath, retryPolicy ?? RetryPolicy.Default)
        {
            this.ServiceBusConnection = serviceBusConnection ?? throw new ArgumentNullException(nameof(serviceBusConnection));
            this.EntityPath           = entityPath;
            this.EntityType           = entityType;
            this.ReceiveMode          = receiveMode;
            this.PrefetchCount        = prefetchCount;
            tokenProvider             = tokenProvider ?? this.ServiceBusConnection.CreateTokenProvider();
            this.CbsTokenProvider     = cbsTokenProvider ?? new TokenProviderAdapter(tokenProvider, this.ServiceBusConnection.OperationTimeout);
            this.diagnosticSource     = new ServiceBusDiagnosticSource(entityPath, serviceBusConnection.Endpoint);

            // Register plugins on the message session.
            if (registeredPlugins != null)
            {
                foreach (var serviceBusPlugin in registeredPlugins)
                {
                    this.RegisterPlugin(serviceBusPlugin);
                }
            }
        }
        internal async Task <ActiveClientRequestResponseLink> OpenRequestResponseLinkAsync(
            string type, string address, MessagingEntityType?entityType, string[] requiredClaims, TimeSpan timeout)
        {
            var         timeoutHelper = new TimeoutHelper(timeout, true);
            AmqpSession session       = null;

            try
            {
                // Don't need to get token for namespace scope operations, included in request
                bool isNamespaceScope = address.Equals(AmqpClientConstants.ManagementAddress, StringComparison.OrdinalIgnoreCase);

                var connection = await this.ConnectionManager.GetOrCreateAsync(timeoutHelper.RemainingTime());

                var sessionSettings = new AmqpSessionSettings {
                    Properties = new Fields()
                };
                //sessionSettings.Properties[AmqpClientConstants.BatchFlushIntervalName] = (uint)batchFlushInterval.TotalMilliseconds;
                session = connection.CreateSession(sessionSettings);

                await session.OpenAsync(timeoutHelper.RemainingTime());

                var linkSettings = new AmqpLinkSettings();
                linkSettings.AddProperty(AmqpClientConstants.TimeoutName, (uint)timeoutHelper.RemainingTime().TotalMilliseconds);
                if (entityType != null)
                {
                    linkSettings.AddProperty(AmqpClientConstants.EntityTypeName, (int)entityType.Value);
                }

                // Create the link
                var link = new RequestResponseAmqpLink(type, session, address, linkSettings.Properties);

                var authorizationValidToUtc = DateTime.MaxValue;

                if (!isNamespaceScope)
                {
                    // TODO: Get Entity level token here
                }

                await link.OpenAsync(timeoutHelper.RemainingTime());

                // Redirected scenario requires entityPath as the audience, otherwise we
                // should always use the full EndpointUri as audience.
                return(new ActiveClientRequestResponseLink(
                           link,
                           this.ConnectionStringBuilder.Endpoint.AbsoluteUri, // audience
                           this.ConnectionStringBuilder.Endpoint.AbsoluteUri, // endpointUri
                           requiredClaims,
                           false,
                           authorizationValidToUtc));
            }
            catch (Exception)
            {
                // Aborting the session will cleanup the link as well.
                session?.Abort();

                throw;
            }
        }
예제 #8
0
 public AmqpMessageSender(AmqpMessagingFactory factory, string entityName, MessagingEntityType?entityType, Microsoft.ServiceBus.RetryPolicy retryPolicy) : base(factory, retryPolicy)
 {
     this.sendLink           = new FaultTolerantObject <SendingAmqpLink>(this, new Action <SendingAmqpLink>(this.CloseLink), new Func <TimeSpan, AsyncCallback, object, IAsyncResult>(this.BeginCreateLink), new Func <IAsyncResult, SendingAmqpLink>(this.EndCreateLink));
     this.messagingFactory   = factory;
     this.entityName         = entityName;
     this.EntityType         = entityType;
     this.clientLinkManager  = new ActiveClientLinkManager(this.messagingFactory);
     this.batchFlushInterval = this.messagingFactory.TransportSettings.BatchFlushInterval;
 }
 internal AmqpMessageSender(string entityName, MessagingEntityType?entityType, ServiceBusConnection serviceBusConnection, ICbsTokenProvider cbsTokenProvider, RetryPolicy retryPolicy)
     : base(serviceBusConnection.OperationTimeout, retryPolicy)
 {
     this.Path                       = entityName;
     this.EntityType                 = entityType;
     this.ServiceBusConnection       = serviceBusConnection;
     this.CbsTokenProvider           = cbsTokenProvider;
     this.SendLinkManager            = new FaultTolerantAmqpObject <SendingAmqpLink>(this.CreateLinkAsync, this.CloseSession);
     this.RequestResponseLinkManager = new FaultTolerantAmqpObject <RequestResponseAmqpLink>(this.CreateRequestResponseLinkAsync, this.CloseRequestResponseSession);
 }
 internal AmqpMessageReceiver(
     string entityName,
     MessagingEntityType?entityType,
     ReceiveMode mode,
     int prefetchCount,
     ServiceBusConnection serviceBusConnection,
     ICbsTokenProvider cbsTokenProvider,
     RetryPolicy retryPolicy)
     : this(entityName, entityType, mode, prefetchCount, serviceBusConnection, cbsTokenProvider, null, retryPolicy)
 {
 }
 public MessageSession(
     string entityPath,
     MessagingEntityType?entityType,
     ReceiveMode receiveMode,
     ServiceBusConnection serviceBusConnection,
     RetryPolicy retryPolicy,
     int prefetchCount      = Constants.DefaultClientPrefetchCount,
     string sessionId       = null,
     bool isSessionReceiver = false)
     : base(entityPath, entityType, receiveMode, serviceBusConnection, retryPolicy, prefetchCount, sessionId, isSessionReceiver)
 {
 }
예제 #12
0
 public MessageSession(
     string entityPath,
     MessagingEntityType?entityType,
     ReceiveMode receiveMode,
     ServiceBusConnection serviceBusConnection,
     ICbsTokenProvider cbsTokenProvider,
     RetryPolicy retryPolicy,
     int prefetchCount      = Constants.DefaultClientPrefetchCount,
     string sessionId       = null,
     bool isSessionReceiver = false)
     : base(entityPath, entityType, receiveMode, serviceBusConnection, cbsTokenProvider, retryPolicy, prefetchCount, sessionId, isSessionReceiver)
 {
     this.diagnosticSource = new ServiceBusDiagnosticSource(entityPath, serviceBusConnection.Endpoint);
 }
예제 #13
0
        internal MessageSender(
            string entityPath,
            string transferDestinationPath,
            MessagingEntityType?entityType,
            ServiceBusConnection serviceBusConnection,
            ICbsTokenProvider cbsTokenProvider,
            RetryPolicy retryPolicy)
            : base(nameof(MessageSender), entityPath, retryPolicy ?? RetryPolicy.Default)
        {
            MessagingEventSource.Log.MessageSenderCreateStart(serviceBusConnection?.Endpoint.Authority, entityPath);

            if (string.IsNullOrWhiteSpace(entityPath))
            {
                throw Fx.Exception.ArgumentNullOrWhiteSpace(entityPath);
            }

            this.ServiceBusConnection = serviceBusConnection ?? throw new ArgumentNullException(nameof(serviceBusConnection));
            this.Path = entityPath;
            this.SendingLinkDestination = entityPath;
            this.EntityType             = entityType;
            this.ServiceBusConnection.ThrowIfClosed();

            if (cbsTokenProvider != null)
            {
                this.CbsTokenProvider = cbsTokenProvider;
            }
            else if (this.ServiceBusConnection.TokenProvider != null)
            {
                this.CbsTokenProvider = new TokenProviderAdapter(this.ServiceBusConnection.TokenProvider, this.ServiceBusConnection.OperationTimeout);
            }
            else
            {
                throw new ArgumentNullException($"{nameof(ServiceBusConnection)} doesn't have a valid token provider");
            }

            this.SendLinkManager            = new FaultTolerantAmqpObject <SendingAmqpLink>(this.CreateLinkAsync, CloseSession);
            this.RequestResponseLinkManager = new FaultTolerantAmqpObject <RequestResponseAmqpLink>(this.CreateRequestResponseLinkAsync, CloseRequestResponseSession);
            this.clientLinkManager          = new ActiveClientLinkManager(this, this.CbsTokenProvider);
            this.diagnosticSource           = new ServiceBusDiagnosticSource(entityPath, serviceBusConnection.Endpoint);

            if (!string.IsNullOrWhiteSpace(transferDestinationPath))
            {
                this.isViaSender             = true;
                this.TransferDestinationPath = transferDestinationPath;
                this.ViaEntityPath           = entityPath;
            }

            MessagingEventSource.Log.MessageSenderCreateStop(serviceBusConnection.Endpoint.Authority, entityPath, this.ClientId);
        }
예제 #14
0
        internal SessionClient(
            string clientTypeName,
            string entityPath,
            MessagingEntityType?entityType,
            ReceiveMode receiveMode,
            int prefetchCount,
            ServiceBusConnection serviceBusConnection,
            ICbsTokenProvider cbsTokenProvider,
            RetryPolicy retryPolicy,
            IList <ServiceBusPlugin> registeredPlugins)
            : base(clientTypeName, entityPath, retryPolicy ?? RetryPolicy.Default)
        {
            if (string.IsNullOrWhiteSpace(entityPath))
            {
                throw Fx.Exception.ArgumentNullOrWhiteSpace(entityPath);
            }

            this.ServiceBusConnection = serviceBusConnection ?? throw new ArgumentNullException(nameof(serviceBusConnection));
            this.EntityPath           = entityPath;
            this.EntityType           = entityType;
            this.ReceiveMode          = receiveMode;
            this.PrefetchCount        = prefetchCount;
            this.ServiceBusConnection.ThrowIfClosed();

            if (cbsTokenProvider != null)
            {
                this.CbsTokenProvider = cbsTokenProvider;
            }
            else if (this.ServiceBusConnection.TokenProvider != null)
            {
                this.CbsTokenProvider = new TokenProviderAdapter(this.ServiceBusConnection.TokenProvider, this.ServiceBusConnection.OperationTimeout);
            }
            else
            {
                throw new ArgumentNullException($"{nameof(ServiceBusConnection)} doesn't have a valid token provider");
            }

            this.diagnosticSource = new ServiceBusDiagnosticSource(entityPath, serviceBusConnection.Endpoint);

            // Register plugins on the message session.
            if (registeredPlugins != null)
            {
                foreach (var serviceBusPlugin in registeredPlugins)
                {
                    this.RegisterPlugin(serviceBusPlugin);
                }
            }
        }
예제 #15
0
 internal MessageSender(
     string entityPath,
     MessagingEntityType?entityType,
     ServiceBusConnection serviceBusConnection,
     ICbsTokenProvider cbsTokenProvider,
     RetryPolicy retryPolicy)
     : base(nameof(MessageSender) + StringUtility.GetRandomString(), retryPolicy ?? RetryPolicy.Default)
 {
     this.OperationTimeout           = serviceBusConnection.OperationTimeout;
     this.Path                       = entityPath;
     this.EntityType                 = entityType;
     this.ServiceBusConnection       = serviceBusConnection;
     this.CbsTokenProvider           = cbsTokenProvider;
     this.SendLinkManager            = new FaultTolerantAmqpObject <SendingAmqpLink>(this.CreateLinkAsync, this.CloseSession);
     this.RequestResponseLinkManager = new FaultTolerantAmqpObject <RequestResponseAmqpLink>(this.CreateRequestResponseLinkAsync, this.CloseRequestResponseSession);
 }
예제 #16
0
        internal MessageSender(
            string entityPath,
            MessagingEntityType?entityType,
            ServiceBusConnection serviceBusConnection,
            RetryPolicy retryPolicy)
            : base(nameof(MessageSender), entityPath, retryPolicy ?? RetryPolicy.Default)
        {
            MessagingEventSource.Log.MessageSenderCreateStart(serviceBusConnection?.Endpoint.Authority, entityPath);

            this.ServiceBusConnection = serviceBusConnection ?? throw new ArgumentNullException(nameof(serviceBusConnection));
            this.OperationTimeout     = serviceBusConnection.OperationTimeout;
            this.Path                       = entityPath;
            this.EntityType                 = entityType;
            this.SendLinkManager            = new FaultTolerantAmqpObject <SendingAmqpLink>(this.CreateLinkAsync, CloseSession);
            this.RequestResponseLinkManager = new FaultTolerantAmqpObject <RequestResponseAmqpLink>(this.CreateRequestResponseLinkAsync, CloseRequestResponseSession);
            this.clientLinkManager          = new ActiveClientLinkManager(this.ClientId);

            MessagingEventSource.Log.MessageSenderCreateStop(serviceBusConnection.Endpoint.Authority, entityPath, this.ClientId);
        }
 internal AmqpMessageReceiver(
     string entityName,
     MessagingEntityType?entityType,
     ReceiveMode mode,
     int prefetchCount,
     ServiceBusConnection serviceBusConnection,
     ICbsTokenProvider cbsTokenProvider,
     string sessionId,
     RetryPolicy retryPolicy,
     bool isSessionReceiver = false)
     : base(mode, serviceBusConnection.OperationTimeout, retryPolicy)
 {
     this.entityName                    = entityName;
     this.EntityType                    = entityType;
     this.ServiceBusConnection          = serviceBusConnection;
     this.CbsTokenProvider              = cbsTokenProvider;
     this.sessionId                     = sessionId;
     this.isSessionReceiver             = isSessionReceiver;
     this.ReceiveLinkManager            = new FaultTolerantAmqpObject <ReceivingAmqpLink>(this.CreateLinkAsync, this.CloseSession);
     this.RequestResponseLinkManager    = new FaultTolerantAmqpObject <RequestResponseAmqpLink>(this.CreateRequestResponseLinkAsync, this.CloseRequestResponseSession);
     this.requestResponseLockedMessages = new ConcurrentExpiringSet <Guid>();
     this.PrefetchCount                 = prefetchCount;
 }
        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);
            }
        }
예제 #19
0
 public CreateBrowserLinkSettings(SbmpMessagingFactory messagingFactory, string entityPath, string entityName, MessagingEntityType?entityType, Lazy <SbmpMessageCreator> controlMessageCreator, RetryPolicy retryPolicy, bool isSessionful) : base(messagingFactory, entityPath, entityName, new Microsoft.ServiceBus.Messaging.Sbmp.LinkInfo()
 {
     LinkId            = messagingFactory.GetNextLinkId(),
     ConnectionId      = messagingFactory.ConnectionId,
     LinkType          = LinkType.Receive,
     EntityName        = entityName,
     EntityType        = entityType,
     IsSessionReceiver = isSessionful,
     IsBrowseMode      = true
 }, controlMessageCreator)
 {
     this.MessageBrowser = new SbmpMessageBrowser(base.EntityPath, base.MessagingFactory, base.MessageCreator, base.ControlMessageCreator, retryPolicy, false);
 }
예제 #20
0
 private AmqpMessageReceiver(AmqpMessagingFactory messagingFactory, string entityName, MessagingEntityType?entityType, string sessionId, bool sessionReceiver, Microsoft.ServiceBus.RetryPolicy retryPolicy, ReceiveMode receiveMode, Microsoft.ServiceBus.Messaging.Filter filter) : base(messagingFactory, retryPolicy, receiveMode, filter)
 {
     this.receiveLink        = new FaultTolerantObject <ReceivingAmqpLink>(this, new Action <ReceivingAmqpLink>(this.CloseLink), new Func <TimeSpan, AsyncCallback, object, IAsyncResult>(this.BeginCreateLink), new Func <IAsyncResult, ReceivingAmqpLink>(this.EndCreateLink));
     this.messagingFactory   = messagingFactory;
     this.entityName         = entityName;
     this.EntityType         = entityType;
     this.sessionId          = sessionId;
     this.sessionReceiver    = sessionReceiver;
     this.PrefetchCount      = this.messagingFactory.PrefetchCount;
     this.lockedMessages     = new ConcurrentDictionary <Guid, ArraySegment <byte> >();
     this.clientLinkManager  = new ActiveClientLinkManager(this.messagingFactory);
     this.batchFlushInterval = this.messagingFactory.TransportSettings.BatchFlushInterval;
 }
예제 #21
0
 public AmqpMessageReceiver(AmqpMessagingFactory messagingFactory, string entityName, MessagingEntityType?entityType, string sessionId, Microsoft.ServiceBus.RetryPolicy retryPolicy, ReceiveMode receiveMode) : this(messagingFactory, entityName, entityType, sessionId, true, retryPolicy, receiveMode, null)
 {
 }
예제 #22
0
 public AmqpMessageReceiver(AmqpMessagingFactory messagingFactory, string entityName, MessagingEntityType?entityType, Microsoft.ServiceBus.RetryPolicy retryPolicy, ReceiveMode receiveMode, Microsoft.ServiceBus.Messaging.Filter filter) : this(messagingFactory, entityName, entityType, null, false, retryPolicy, receiveMode, filter)
 {
 }
예제 #23
0
 public void AmqpReceiveLinkCreateStart(string clientId, bool isRequestResponseLink, MessagingEntityType?entityType, string entityPath)
 {
     if (this.IsEnabled())
     {
         this.AmqpReceiveLinkCreateStart(clientId, isRequestResponseLink.ToString(), entityType?.ToString() ?? string.Empty, entityPath);
     }
 }
예제 #24
0
 public AcceptMessageSessionAsyncResult(SbmpMessagingFactory messagingFactory, string entityName, string sessionId, MessagingEntityType?entityType, ReceiveMode receiveMode, int prefetchCount, Lazy <SbmpMessageCreator> controlMessageCreator, TimeSpan serverWaitTime, TimeSpan timeout, AsyncCallback callback, object state) : this(messagingFactory, entityName, sessionId, entityType, receiveMode, prefetchCount, controlMessageCreator, null, serverWaitTime, timeout, callback, state)
 {
 }
        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 CreateSenderLinkSettings(SbmpMessagingFactory messagingFactory, string entityName, MessagingEntityType?entityType, RetryPolicy retryPolicy) : this(messagingFactory, entityName, entityType, null, retryPolicy)
 {
 }
 public CreateSenderLinkSettings(SbmpMessagingFactory messagingFactory, string entityName, MessagingEntityType?entityType, string transferDestinationEntityName) : this(messagingFactory, entityName, entityType, transferDestinationEntityName, null)
 {
 }
예제 #28
0
        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 CreateReceiverLinkSettings(SbmpMessagingFactory messagingFactory, string entityPath, string entityName, MessagingEntityType?entityType, ReceiveMode receiveMode, Lazy <SbmpMessageCreator> controlMessageCreator, RetryPolicy retryPolicy, bool isSessionful) : this(messagingFactory, entityPath, entityName, entityType, receiveMode, controlMessageCreator, retryPolicy, isSessionful, null)
 {
 }