示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComponentryContainer"/> class.
 /// </summary>
 /// <param name="clock">The container clock.</param>
 /// <param name="guidFactory">The container GUID factory.</param>
 /// <param name="loggerFactory">The container logger factory.</param>
 public ComponentryContainer(
     IZonedClock clock,
     IGuidFactory guidFactory,
     ILoggerFactory loggerFactory)
 {
     this.Clock         = clock;
     this.GuidFactory   = guidFactory;
     this.LoggerFactory = loggerFactory;
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Component"/> class.
        /// </summary>
        /// <param name="container">The components componentry container.</param>
        /// <param name="subName">The sub-name for the component.</param>
        protected Component(IComponentryContainer container, string subName)
        {
            this.clock       = container.Clock;
            this.guidFactory = container.GuidFactory;

            this.Name   = new Label($"{this.GetType().NameFormatted()}{SetSubName(subName)}");
            this.Logger = container.LoggerFactory.CreateLogger(this.Name.Value);

            this.InitializedTime = this.clock.TimeNow();
            this.Logger.LogDebug(LogId.Component, "Initialized.");
        }
示例#3
0
        public SchedulerTests(ITestOutputHelper output)
        {
            // Fixture Setup
            this.output = output;

            var container = TestComponentryContainer.Create(output);

            this.clock     = container.Clock;
            this.receiver  = new MockComponent(container).Endpoint;
            this.scheduler = new Scheduler(container, new MockMessageBusProvider(container).Adapter);
            this.scheduler.Start().Wait();
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixComponent"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="config">The FIX configuration.</param>
        /// <param name="messageHandler">The FIX message handler.</param>
        /// <param name="messageRouter">The FIX message router.</param>
        protected FixComponent(
            IComponentryContainer container,
            IMessageBusAdapter messagingAdapter,
            FixConfiguration config,
            IFixMessageHandler messageHandler,
            IFixMessageRouter messageRouter)
        {
            this.clock            = container.Clock;
            this.guidFactory      = container.GuidFactory;
            this.Logger           = container.LoggerFactory.CreateLogger(this.GetType().Name);
            this.messagingAdapter = messagingAdapter;

            this.FixMessageHandler = messageHandler;
            this.FixMessageRouter  = messageRouter;

            this.AccountId     = new AccountId(config.Broker, config.Credentials.AccountNumber, config.AccountType);
            this.Brokerage     = this.AccountId.Broker;
            this.AccountNumber = this.AccountId.AccountNumber;

            this.credentials    = config.Credentials;
            this.configPath     = config.ConfigPath;
            this.sendAccountTag = config.SendAccountTag;
            this.accountField   = new Account(this.AccountNumber.Value);
        }
示例#5
0
 public AccountTests()
 {
     this.clock = new TestClock();
 }