Example #1
0
        private static void BindAgentConfiguration(this IServiceCollection services, IConfiguration configuration)
        {
            var agentConfiguration = new AgentConfiguration();

            configuration.Bind("Agent", agentConfiguration);
            services.AddSingleton(agentConfiguration);
        }
Example #2
0
        /// <summary>
        /// Create a new publisher
        /// </summary>
        /// <remarks>The publisher is a very central class; generally there should be only one per process.
        /// More specifically, there should be a one to one relationship between publisher, packet cache, and
        /// messengers to ensure integrity of the message output.</remarks>
        public Publisher(string sessionName, AgentConfiguration configuration, SessionSummary sessionSummary)
        {
            if (string.IsNullOrEmpty(sessionName))
            {
                throw new ArgumentNullException(nameof(sessionName));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (sessionSummary == null)
            {
                throw new ArgumentNullException(nameof(sessionSummary));
            }

            //store off all our input
            m_SessionName    = sessionName;
            m_SessionSummary = sessionSummary;
            m_Configuration  = configuration;

            //create our queue, cache, and messenger objects
            m_MessageQueue         = new Queue <PacketEnvelope>(50); //a more or less arbitrary initial queue size.
            m_MessageOverflowQueue = new Queue <PacketEnvelope>(50); //a more or less arbitrary initial queue size.
            m_CachedTypes          = new PacketDefinitionList();
            m_PacketCache          = new PacketCache();
            m_Messengers           = new List <IMessenger>();

            m_MessageQueueMaxLength = Math.Max(configuration.Publisher.MaxQueueLength, 1); //make sure there's no way to get it below 1.

            //create the thread we use for dispatching messages
            CreateMessageDispatchThread();
        }
        /// <summary>
        /// Adds a sovrin issuer agent with the provided configuration
        /// </summary>
        /// <param name="services">The services.</param>
        /// <param name="agentConfiguration">The agent configuration.</param>
        /// <param name="serviceConfiguration">The service resolution configuration</param>
        public static void AddAgent(this IServiceCollection services,
                                    Action <AgentConfiguration> agentConfiguration = null, Action <AgentServicesBuilder> serviceConfiguration = null)
        {
            RegisterCoreServices(services);

            var serviceBuilder = new AgentServicesBuilder(services);

            serviceConfiguration?.Invoke(serviceBuilder);
            serviceBuilder.AddCoreServices();

            services = serviceBuilder.Services;

            var defaultConfiguration = new AgentConfiguration();

            agentConfiguration?.Invoke(defaultConfiguration);

            services.Configure <WalletOptions>((obj) =>
            {
                obj.WalletConfiguration = defaultConfiguration.WalletOptions.WalletConfiguration;
                obj.WalletCredentials   = defaultConfiguration.WalletOptions.WalletCredentials;
            });

            services.Configure <PoolOptions>((obj) =>
            {
                obj.PoolName        = defaultConfiguration.PoolOptions.PoolName;
                obj.GenesisFilename = defaultConfiguration.PoolOptions.GenesisFilename;
            });
        }
Example #4
0
        public GalileoAgent(AgentConfiguration configuration, IEntriesQueue queue)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (queue == null)
            {
                throw new ArgumentNullException(nameof(queue));
            }

            Configuration = configuration;
            Queue         = queue;

            collectorConnector = new CollectorConnector(
                new HttpClient(),
                Configuration.Host,
                Configuration.Port,
                Configuration.GalileoServiceToken,
                AgentName,
                AgentVersion,
                Configuration.Environment,
                Configuration.RequestCompression);

            flushTimer = new Timer(ElapsedFlushTimeout, this, 0, Configuration.FlushTimeout * 1000);
        }
Example #5
0
        public void GetGoalDirectionDoesNotReturnOppositeDirection()
        {
            int shortTime = 4;
            AgentConfiguration agentConfiguration = new AgentConfiguration();

            agentConfiguration.TeamID = "Red";
            agentConfiguration.CsIP   = "127.0.0.1";
            agentConfiguration.CsPort = 54321;
            Agent.Agent agentRed  = new Agent.Agent(agentConfiguration);
            var         teamMates = new int[3] {
                2, 3, 4
            };
            var enemiesIds = new int[3] {
                5, 7, 6
            };

            startGamePayload = new StartGamePayload(1, teamMates, 1, enemiesIds, TeamId.Red, new Point(5, 5), 1, 3, 3, 4, 4, new System.Collections.Generic.Dictionary <ActionType, TimeSpan>(), 0.5f, new Point(0, 0));
            agentRed.StartGameComponent.Initialize(startGamePayload);
            Assert.AreNotEqual(Common.GetGoalDirection(agentRed, shortTime, out _), Direction.South);
            agentConfiguration.TeamID = "Blue";
            Agent.Agent agentBlue = new Agent.Agent(agentConfiguration);
            startGamePayload = new StartGamePayload(1, teamMates, 1, enemiesIds, TeamId.Blue, new Point(5, 5), 1, 3, 3, 4, 4, new System.Collections.Generic.Dictionary <ActionType, TimeSpan>(), 0.5f, new Point(0, 0));
            agentBlue.StartGameComponent.Initialize(startGamePayload);
            Assert.AreNotEqual(Common.GetGoalDirection(agentBlue, shortTime, out _), Direction.North);
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Enable != null)
         {
             hashCode = hashCode * 59 + Enable.GetHashCode();
         }
         if (AgentConfiguration != null)
         {
             hashCode = hashCode * 59 + AgentConfiguration.GetHashCode();
         }
         if (ContextPath != null)
         {
             hashCode = hashCode * 59 + ContextPath.GetHashCode();
         }
         if (DisabledCipherSuites != null)
         {
             hashCode = hashCode * 59 + DisabledCipherSuites.GetHashCode();
         }
         if (EnabledCipherSuites != null)
         {
             hashCode = hashCode * 59 + EnabledCipherSuites.GetHashCode();
         }
         return(hashCode);
     }
 }
        private IEvent GetProcessCreationEvent(Dictionary <string, string> ev)
        {
            var commandline = GetEventPropertyFromMessage(ev[MessageFieldName], NewProcessCommandLineFieldName);
            var executable  = GetEventPropertyFromMessage(ev[MessageFieldName], ProcessNameFieldName);

            var payload = new ProcessCreationPayload
            {
                Executable      = executable,
                ProcessId       = Convert.ToUInt32(GetEventPropertyFromMessage(ev[MessageFieldName], ProcessIdFieldName), 16),
                ParentProcessId = Convert.ToUInt32(GetEventPropertyFromMessage(ev[MessageFieldName], CreatorProcessIdFieldName), 16),
                UserName        = GetEventPropertyFromMessage(ev[MessageFieldName], AccountNameFieldName, 1),
                UserId          = GetEventPropertyFromMessage(ev[MessageFieldName], LogonIdFieldName),
                CommandLine     = string.IsNullOrWhiteSpace(commandline) ? executable : commandline,
                Time            = DateTime.Parse(ev[TimeGeneratedFieldName]),
                ExtraDetails    = new Dictionary <string, string>
                {
                    { $"CREATOR_{SecurityIdFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], SecurityIdFieldName) },
                    { $"CREATOR_{AccountDomainFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], AccountDomainFieldName) },
                    { $"CREATOR_{AccountNameFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], AccountNameFieldName) },
                    { $"TARGET_{SecurityIdFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], SecurityIdFieldName, 1) },
                    { $"TARGET_{AccountDomainFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], AccountDomainFieldName, 1) },
                    { $"TARGET_{AccountNameFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], AccountNameFieldName, 1) },
                    { $"TARGET_{LogonIdFieldName}", GetEventPropertyFromMessage(ev[MessageFieldName], LogonIdFieldName, 1) },
                    { TokenElevationTypeFieldName, GetEventPropertyFromMessage(ev[MessageFieldName], TokenElevationTypeFieldName) },
                    { MandatoryLabelFieldName, GetEventPropertyFromMessage(ev[MessageFieldName], MandatoryLabelFieldName) }
                }
            };

            return(new ProcessCreate(AgentConfiguration.GetEventPriority <ProcessCreate>(), payload));
        }
 public DefaultConfigurationManager(IEnumerable<IConfigurationRepository> repositories,
     AgentConfiguration agentInfo)
 {
     _repositories = repositories;
     _agentInfo = agentInfo;
     _pendingChanges = new List<ConfigurationChangeRequest>();
 }
Example #9
0
        private Agent.Agent GetDefaultAgent()
        {
            var config = AgentConfiguration.GetDefault();

            config.Strategy = -1; //DoNothingStrategy
            return(GetInitializedAgent(config));
        }
Example #10
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (CheckForDuplicateProcess())
            {
                MessageBox.Show("Server Density is already running. Click its icon in the system tray to view your configuration.", "Server Density", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
                return;
            }

            AgentConfiguration config = AgentConfiguration.Load();

            _url.Text                     = config.Url;
            _agentKey.Text                = config.AgentKey;
            _iis.Checked                  = config.IISChecks;
            _pluginDirectory.Text         = config.PluginDirectory;
            _plugins.Checked              = !string.IsNullOrEmpty(config.PluginDirectory);
            _mongoDBConnectionString.Text = config.MongoDBConnectionString;
            _mongoDB.Checked              = !string.IsNullOrEmpty(config.MongoDBConnectionString);
            _dbStats.Checked              = config.MongoDBDBStats;
            _replSet.Checked              = config.MongoDBReplSet;
            _sqlServer.Checked            = config.SQLServerChecks;
            _customPrefix.Checked         = !string.IsNullOrEmpty(config.CustomPrefix);
            _customPrefixValue.Text       = config.CustomPrefix;
            _eventViewer.Checked          = config.EventViewer;

            // Initialise and start the background update checker.
            _updater = new Updater();
            _updater.UpdatesDetected += Updater_UpdatesDetected;
            _updater.Start();
        }
Example #11
0
        public void TestSendingGameJoin()
        {
            File.WriteAllText("TMPpath.txt",
                              "{\"CsIP\": \"127.0.0.1\"," +
                              "\"CsPort\": 8080," +
                              "\"teamID\": \"red\"," +
                              "\"strategy\": 1}");
            string[] args = new string[1] {
                "./TMPpath.txt"
            };

            AgentConfiguration configuration = AgentConfiguration.ReadConfiguration(args);

            TcpListener serverSideListener = new TcpListener(IPAddress.Any, configuration.CsPort);

            serverSideListener.Start();
            TcpClient serverSide = null;
            var       task       = new Task(() => serverSide = serverSideListener.AcceptTcpClient());

            task.Start();

            Agent.Agent agent = new Agent.Agent(configuration);
            agent.StartListening();

            task.Wait();
            serverSideListener.Stop();
            IMessageSenderReceiver senderReceiver = new StreamMessageSenderReceiver(serverSide.GetStream(), new Parser());

            senderReceiver.StartReceiving(message =>
            {
                Assert.AreEqual(message.MessageId, MessageType.JoinGameRequest);
            });
        }
Example #12
0
        /// <summary>
        /// Apply the provided listener configuration
        /// </summary>
        /// <param name="publisher">The publisher to record events to</param>
        /// <param name="agentConfiguration">The active agent configuration</param>
        /// <param name="async">True to initialize asynchronously</param>
        /// <remarks>If calling initialization from a path that may have started with the trace listener,
        /// you must set suppressTraceInitialize to true to guarantee that the application will not deadlock
        /// or throw an unexpected exception.</remarks>
        internal static void Initialize(Publisher publisher, AgentConfiguration agentConfiguration, bool async)
        {
            //get a configuration lock so we can update the configuration
            lock (m_ConfigLock)
            {
                m_Publisher = publisher;

                //and store the configuration; it's processed by the background thread.
                m_Configuration       = agentConfiguration; // Set the top config before the local Listener config.
                m_PendingConfigChange = true;

                //wait for our events to initialize always on our background thread
                while (m_EventsInitialized == false)
                {
                    System.Threading.Monitor.Wait(m_ConfigLock, 16);
                }

                //and if we're doing a synchronous init then we even wait for the polled listeners.
                while ((async == false) && (m_PendingConfigChange))
                {
                    System.Threading.Monitor.Wait(m_ConfigLock, 16);
                }

                System.Threading.Monitor.PulseAll(m_ConfigLock);
            }
        }
        public void Listener()
        {
            //get the configuration class
            var curConfiguration = new AgentConfiguration().Listener;

            //store off the current configuration
            bool initialEnableConsole = curConfiguration.EnableConsole;

            //now change each value and see that the change takes, but only changes the property it should.
            curConfiguration.EnableConsole = !initialEnableConsole;
            Assert.AreEqual(curConfiguration.EnableConsole, !initialEnableConsole);
            //Assert.AreEqual(MonitorConfiguration.Listener.EnableConsoleRedirector, curConfiguration.EnableConsoleRedirector);

            //now set it back.
            curConfiguration.EnableConsole = initialEnableConsole;
            Assert.AreEqual(curConfiguration.EnableConsole, initialEnableConsole);
            //Assert.AreEqual(MonitorConfiguration.Listener.EnableConsoleRedirector, curConfiguration.EnableConsoleRedirector);

            //now change each value and see that the change takes, but only changes the property it should.
            Assert.AreEqual(curConfiguration.EnableConsole, initialEnableConsole);
            //Assert.AreEqual(MonitorConfiguration.Listener.CatchUnhandledExceptions, curConfiguration.CatchUnhandledExceptions);

            //now set it back.
            Assert.AreEqual(curConfiguration.EnableConsole, initialEnableConsole);
            //Assert.AreEqual(MonitorConfiguration.Listener.CatchUnhandledExceptions, curConfiguration.CatchUnhandledExceptions);
        }
Example #14
0
        public async Task <AgentConfiguration> ConfigureAgent(AgentConfiguration agent)
        {
            if (PropsAreNull(agent))
            {
                throw new ArgumentNullException();
            }
            var query = @"IF NOT EXISTS (
	                        SELECT AgentId, Parent_Id
	                        FROM AgentConfiguration
	                        WHERE AgentId = @agentId
	                        AND Parent_Id = @parentId
                        )
                        BEGIN
                        INSERT INTO AgentConfiguration(AgentId, Parent_Id)
                        VALUES(@agentId, @parentId)
                        END";

            var p = new DynamicParameters();

            p.Add("@agentId", agent.AgentId);
            p.Add("@parentId", agent.ParentId);

            try
            {
                var result = await _db.QueryAsync(query, p);

                return(result.SingleOrDefault());
            }
            catch (SqlException)
            {
                throw;
            }
        }
Example #15
0
 public DefaultConfigurationManager(IEnumerable <IConfigurationRepository> repositories,
                                    AgentConfiguration agentInfo)
 {
     _repositories   = repositories;
     _agentInfo      = agentInfo;
     _pendingChanges = new List <ConfigurationChangeRequest>();
 }
Example #16
0
        public void RunBeforeAnyTests()
        {
            //delete the existing local logs folder for us...
            try
            {
                var path = Path.Combine(Environment.GetEnvironmentVariable(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "ProgramData" : "Home"), @"Gibraltar\Local Logs\NUnit");
                Directory.Delete(path, true);
            }
            catch (Exception ex)
            {
                Trace.TraceWarning("Unable to clean out local logs directory due to " + ex.GetType());
            }

            Log.Initializing += Log_Initializing;
            m_Configuration   = new AgentConfiguration();
            PublisherConfiguration publisher = m_Configuration.Publisher;

            publisher.ProductName     = "NUnit";
            publisher.ApplicationName = "Gibraltar.Agent.Test";

            //and now try to get the file version.  This is risky.
            var fileVersionAttributes = this.GetType().GetTypeInfo().Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute));

            if (fileVersionAttributes != null)
            {
                AssemblyFileVersionAttribute leadAttribute = fileVersionAttributes.FirstOrDefault() as AssemblyFileVersionAttribute;

                if (leadAttribute != null)
                {
                    publisher.ApplicationVersion = new Version(leadAttribute.Version);
                }
            }

            publisher.ApplicationDescription = "NUnit tests of the Loupe Agent Library";

            m_Configuration.SessionFile.EnableFilePruning = false;

            //if we need email server information set that
#if CONFIGURE_EMAIL
            EmailConfiguration email = e.Configuration.Email;
            email.Server   = EmailServer;
            email.Port     = EmailServerPort;
            email.User     = EmailServerUser;
            email.Password = EmailServerPassword;
            email.UseSsl   = EmailUseSsl;

            PackagerConfiguration packager = e.Configuration.Packager;
            packager.DestinationEmailAddress = EmailToAddress;
            packager.FromEmailAddress        = EmailFromAddress;
#endif

            //force us to initialize logging
            Log.StartSession(m_Configuration);
            Trace.TraceInformation("Starting testing at {0} on computer {1}", DateTimeOffset.UtcNow, Log.SessionSummary.HostName);

            //we have to test this before we get into the application user tests and start manipulating the properties.
            Assert.That(Gibraltar.Monitor.Log.PrincipalResolver, Is.InstanceOf(typeof(DefaultPrincipalResolver)));
            Assert.That(Log.PrincipalResolver, Is.InstanceOf(typeof(DefaultPrincipalResolver)));
        }
Example #17
0
 private static AgentInfo BuildAgentInfo(AgentConfiguration config)
 {
     return(new AgentInfo
     {
         SiteId = config.SiteId,
         AgentId = Environment.MachineName
     });
 }
Example #18
0
        public void AcceptMessage_ShouldNotJoinWnehRejected()
        {
            var config = AgentConfiguration.GetDefault();

            agent            = new Agent.Agent(config);
            agent.AgentState = AgentState.WaitingForJoin;
            agent.AcceptMessage(GetBaseMessage(new JoinResponse(false, 1), 1));
            Assert.AreEqual(agent.AgentState, AgentState.WaitingForJoin);
        }
Example #19
0
        public AgentStatusService(IApiClientFactory apiClientFactory, IConfigurationService configurationService,
                                  ILogger logger)
        {
            _registrationQueueApiClient = apiClientFactory.GetClientFor <AgentRegistrationQueue>();
            _agentApiClient             = apiClientFactory.GetClientFor <Models.Resources.V1.Agent>();

            _agentConfiguration = configurationService.Get <AgentConfiguration>();
            _logger             = logger;
        }
Example #20
0
        private Agent.Agent GetInitializedAgent(AgentConfiguration config)
        {
            agent = new Agent.Agent(config);

            var startGamePayload = GetDefaultStartGamePayload();

            agent.StartGameComponent.Initialize(startGamePayload);
            return(agent);
        }
Example #21
0
        public void AcceptMessage_ShouldJoinWhenAccepted()
        {
            var config = AgentConfiguration.GetDefault();

            agent            = new Agent.Agent(config);
            agent.AgentState = AgentState.WaitingForJoin;
            agent.AcceptMessage(GetBaseMessage(new JoinResponse(true, 1), 1));
            Assert.AreEqual(agent.AgentState, AgentState.WaitingForStart);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LoupeLoggerProvider"/> class.
        /// </summary>
        /// <param name="configuration">Optional. The application configuration.</param>
        /// <param name="configure">Optional.  An action to modify the Loupe agent configuration.</param>
        public LoupeLoggerProvider(IConfiguration configuration, LoupeAgentConfigurationCallback configure = null)
        {
            var agentConfiguration = new AgentConfiguration();

            configuration?.GetSection("Loupe")?.Bind(agentConfiguration);
            configure?.Invoke(agentConfiguration);

            Log.StartSession(agentConfiguration);
        }
        /// <summary>
        /// Initialize the proxy with the current agent configuration
        /// </summary>
        /// <param name="configuration"></param>
        public static void Initialize(AgentConfiguration configuration, ProxyConfiguration proxyConfiguration)
        {
            var serverConfig = configuration.Server;

            if (serverConfig.Enabled == false)
            {
                //log that we can't fire up because server configuration is disabled
                Log.Information(LogCategory, "Loupe Proxy is Disabled because Server configuration is disabled",
                                "The Loupe proxy uses the server configuration for the current application to connect" +
                                "to the server. Since that is disabled the proxy will not start.");
                return;
            }

            Configuration = proxyConfiguration;

            var hostName = serverConfig.UseGibraltarService ? SdsServerName : serverConfig.Server;

            hostName = hostName?.Trim();

            if (string.IsNullOrEmpty(hostName))
            {
                Log.Warning(LogCategory, "Loupe Proxy is Disabled because Server configuration is incomplete or incorrect",
                            "The Loupe proxy uses the server configuration for the current application to connect" +
                            "to the server. Since that is incomplete or incorrect the proxy will not start.\r\n\r\n{0}",
                            ServerConfigurationDescription(serverConfig));
                return;
            }

            //format up base directory in case we get something we can't use.  It has to have leading & trailing slashes.
            var effectiveRepository =
                serverConfig.UseGibraltarService ? serverConfig.CustomerName : serverConfig.Repository;
            var applicationBaseDirectory = EffectiveApplicationBaseDirectory(serverConfig.ApplicationBaseDirectory, effectiveRepository);

            bool useSsl = serverConfig.UseGibraltarService || serverConfig.UseSsl;

            var baseServerAddressRaw = CalculateBaseAddress(useSsl, hostName, applicationBaseDirectory, serverConfig);

            if (Uri.TryCreate(baseServerAddressRaw, UriKind.Absolute, out var baseServerAddress) == false)
            {
                Log.Warning(LogCategory, "Loupe Proxy is Disabled because Server configuration is incomplete or incorrect",
                            "The Loupe proxy uses the server configuration for the current application to connect" +
                            "to the server. Since that is incomplete or incorrect the proxy will not start.\r\n\r\n{0}",
                            ServerConfigurationDescription(serverConfig));
            }

            //now we can finally create our one true HTTP client.
            _serverClient = new HttpClient {
                BaseAddress = baseServerAddress
            };

            //and log that we're initialized.
            Log.Information(LogCategory, "Loupe Proxy is Enabled",
                            "The Loupe proxy has started and will process requests sent to this application.\r\n\r\n{0}",
                            ServerConfigurationDescription(serverConfig));

            Enabled = true;
        }
Example #24
0
        public FastStartAgent(AgentConfiguration config,
            ILoader<INotificationEventPublisher> publisherLoader,
            ILoader<IHealthCheckSchedulerPlugin> checksLoader,
            ILoader<IActivityPlugin> activitiesLoader)
            : base(config, publisherLoader, checksLoader, activitiesLoader)
        {
            InternalIdentity = new PluginDescriptor
                             {
                                 Description = "Fast Startup Agent",
                                 Name = "FastStartAgent",
                                 TypeId = new Guid("F90773BA-C659-4964-B22D-A998719CB1FD")
                             };

            _startingGate = new ManualResetEvent(false);
        }
Example #25
0
        public Agent(AgentConfiguration config,
            ILoader<INotificationEventPublisher> publisherLoader,
            ILoader<IHealthCheckSchedulerPlugin> checksLoader,
            ILoader<IActivityPlugin> activitiesLoader)
        {
            _config = config;
            PublisherLoader = publisherLoader;
            ChecksLoader = checksLoader;
            ActivitiesLoader = activitiesLoader;

            InternalIdentity = new PluginDescriptor
                             {
                                 Description = "Agent description [TODO]",
                                 Name = "Agent",
                                 TypeId = new Guid("649D0AAC-3AA0-4457-B82D-F834EA324CFA")
                             };
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AnnouncementModule"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="log">The log.</param>
 public AnnouncementModule(AgentConfiguration options, ILog log)
 {
     announcementInterval = options.AnnouncementInterval;
     scope = options.Scope;
     this.log = log;
 }
Example #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscoveryModule"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 public DiscoveryModule(AgentConfiguration options)
 {
     scope = options.Scope;
 }
        public IRolePlugin Start()
        {
            var agentConfig = new AgentConfiguration
                                  {
                                      AgentId = "TestAgent"
                                  };

            Container.Initialise();
            Messenger.Initialise(new MagnumMessenger());
            Messenger.InterceptBefore<NotificationEvent>(msg => NotificationEvents.Add(msg));
            Messenger.InterceptBefore<NotificationRequest>(msg => NotificationRequests.Add(msg));
            NotificationHub.Initialise(new DefaultNotificationHub(agentConfig, _notificationFilters));

            RunStartupPlugins();

            _customPluginActions.ForEach(a => a(this));

            _role = new Agent.Roles.Agent(agentConfig,
                                           _publisherLoader,
                                           _checkLoader,
                                           _activityLoader);
            _role.Start();
            return _role;
        }