Пример #1
0
        protected internal override void Setup(FeatureConfigurationContext context)
        {
            var defaultAddress = context.Settings.LocalAddress();
            var hostInfo = new HostInformation(context.Settings.Get<Guid>("NServiceBus.HostInformation.HostId"), 
                context.Settings.Get<string>("NServiceBus.HostInformation.DisplayName"), 
                context.Settings.Get<Dictionary<string, string>>("NServiceBus.HostInformation.Properties"));
            
            context.Container.ConfigureComponent<Unicast.UnicastBus>(DependencyLifecycle.SingleInstance)
                .ConfigureProperty(u => u.InputAddress, defaultAddress)
                .ConfigureProperty(u => u.HostInformation, hostInfo);

            ConfigureSubscriptionAuthorization(context);

            context.Container.ConfigureComponent<PipelineExecutor>(DependencyLifecycle.SingleInstance);
            ConfigureBehaviors(context);

            var knownMessages = context.Settings.GetAvailableTypes()
                .Where(context.Settings.Get<Conventions>().IsMessageType)
                .ToList();

            RegisterMessageOwnersAndBusAddress(context, knownMessages);

            ConfigureMessageRegistry(context, knownMessages);

            if (context.Settings.GetOrDefault<bool>("Endpoint.SendOnly"))
            {
                return;
            }

            SetTransportThresholds(context);
        }
 void ExecuteHeartbeat(HostInformation hostInfo)
 {
     var heartBeat = new EndpointHeartbeat
     {
         ExecutedAt = DateTime.UtcNow,
         EndpointName = Configure.Settings.EndpointName(),
         Host = hostInfo.DisplayName,
         HostId = hostInfo.HostId
     };
     backend.Send(heartBeat, ttlTimeSpan);
 }
 void SendStartupMessageToBackend(HostInformation hostInfo)
 {
     backend.Send(
         new RegisterEndpointStartup
         {
             HostId = hostInfo.HostId,
             Host = hostInfo.DisplayName,
             Endpoint = Configure.Settings.EndpointName(),
             HostDisplayName = hostInfo.DisplayName,
             HostProperties = hostInfo.Properties,
             StartedAt = DateTime.UtcNow
         }, ttlTimeSpan);
 }
Пример #4
0
        internal static HostInformation CreateHostInformation(string commandLine, string machineName)
        {
            string fullPathToStartingExe;

            if (commandLine.StartsWith("\""))
            {
                fullPathToStartingExe = (from Match match in Regex.Matches(commandLine, "\"([^\"]*)\"")
                                         select match.ToString()).First().Trim('"');
            }
            else
            {
                fullPathToStartingExe = commandLine.Split(' ').First();
            }

            var hostId = DeterministicGuid.Create(fullPathToStartingExe, machineName);

            var hostInfo = new HostInformation(hostId, machineName);

            hostInfo.Properties.Add("PathToExecutable", fullPathToStartingExe);

            return(hostInfo);
        }
Пример #5
0
        internal static HostInformation CreateHostInformation(string commandLine, string machineName)
        {
            string fullPathToStartingExe;

            if (commandLine.StartsWith("\""))
            {
                fullPathToStartingExe = (from Match match in Regex.Matches(commandLine, "\"([^\"]*)\"")
                    select match.ToString()).First().Trim('"');
            }
            else
            {
                fullPathToStartingExe = commandLine.Split(' ').First();
            }

            var hostId = DeterministicGuid.Create(fullPathToStartingExe, machineName);

            var hostInfo= new HostInformation(hostId, machineName);

            hostInfo.Properties.Add("PathToExecutable", fullPathToStartingExe);

            return hostInfo;
        }