Example #1
0
        public ListenerExceptionStatus Register(BaseUriWithWildcard path)
        {
            if (path.BaseAddress.Scheme == Uri.UriSchemeNetTcp)
            {
                if (transportType == TransportType.NamedPipe)
                {
                    return(ListenerExceptionStatus.ProtocolUnsupported);
                }

                maxQueueSize  = ListenerConfig.NetTcp.MaxPendingConnections;
                transportType = TransportType.Tcp;
            }
            else if (path.BaseAddress.Scheme == Uri.UriSchemeNetPipe)
            {
                if (transportType == TransportType.Tcp)
                {
                    return(ListenerExceptionStatus.ProtocolUnsupported);
                }

                maxQueueSize  = ListenerConfig.NetPipe.MaxPendingConnections;
                transportType = TransportType.NamedPipe;
            }
            else
            {
                return(ListenerExceptionStatus.ProtocolUnsupported);
            }

            ListenerExceptionStatus status;
            int registrationRetries = AppSettings.ListenerRegistrationRetryCount;

            do
            {
                status = RoutingTable.Start(this, path);
                if (status == ListenerExceptionStatus.ConflictingRegistration)
                {
                    if (registrationRetries > 0)
                    {
                        Thread.Sleep(AppSettings.ListenerRegistrationRetryDelay);
                    }
                }
                else
                {
                    break;
                }
            } while (registrationRetries-- > 0);

            if (status == ListenerExceptionStatus.Success)
            {
                paths.Add(path);
                IncrementUrisRegisteredCounters();
                OnRegisterCompleted();
            }

            return(status);
        }
Example #2
0
        bool IConnectionRegister.ValidateUriRoute(Uri uri, System.Net.IPAddress address, int port)
        {
            if (this.queue == null)
            {
                AbortServiceInstance();
                return(false);
            }

            MessageQueue destinationQueue = RoutingTable.Lookup(uri, address, port);

            return(object.ReferenceEquals(destinationQueue, this.queue));
        }
        protected override void OnCustomCommand(int command)
        {
            switch (command)
            {
            case (int)CustomCommand.DumpTable:
                RoutingTable.DumpTables(TransportType.Tcp);
                break;

            default:
                break;
            }
        }
Example #4
0
        public void OnCustomCommand(int command)
        {
            switch (command)
            {
            case (int)CustomCommand.DumpTable:
                RoutingTable.DumpTables(transportType);
                break;

            case (int)CustomCommand.CheckHealth:
                Fx.Assert(IsHealthy(), "Not healthy, killing ourselves!");
                break;

            default:
                break;
            }
        }
Example #5
0
        void Unregister(BaseUriWithWildcard path)
        {
            Fx.Assert(paths.Contains(path), "Unregister: unregistering an unregistered path");

            if (DiagnosticUtility.ShouldTraceInformation)
            {
                ListenerTraceUtility.TraceEvent(TraceEventType.Information, ListenerTraceCode.MessageQueueUnregisterSucceeded, SR.GetString(SR.TraceCodeMessageQueueUnregisterSucceeded), new StringTraceRecord("Path", path.ToString()), this, null);
            }

            if (TD.MessageQueueUnregisterSucceededIsEnabled())
            {
                TD.MessageQueueUnregisterSucceeded(this.EventTraceActivity, path.ToString());
            }

            RoutingTable.Stop(this, path);
            IncrementUrisUnregisteredCounters();
            OnUnregisterCompleted();

            registry.Remove(path);
            paths.Remove(path);
        }
        public ListenerExceptionStatus Register(BaseUriWithWildcard path)
        {
            if (path.BaseAddress.Scheme == Uri.UriSchemeNetTcp)
            {
                if (transportType == TransportType.NamedPipe)
                {
                    return(ListenerExceptionStatus.ProtocolUnsupported);
                }

                maxQueueSize  = ListenerConfig.NetTcp.MaxPendingConnections;
                transportType = TransportType.Tcp;
            }
            else if (path.BaseAddress.Scheme == Uri.UriSchemeNetPipe)
            {
                if (transportType == TransportType.Tcp)
                {
                    return(ListenerExceptionStatus.ProtocolUnsupported);
                }

                maxQueueSize  = ListenerConfig.NetPipe.MaxPendingConnections;
                transportType = TransportType.NamedPipe;
            }
            else
            {
                return(ListenerExceptionStatus.ProtocolUnsupported);
            }

            ListenerExceptionStatus status = RoutingTable.Start(this, path);

            if (status == ListenerExceptionStatus.Success)
            {
                paths.Add(path);
                IncrementUrisRegisteredCounters();
                OnRegisterCompleted();
            }

            return(status);
        }