Example #1
0
 private void RegisterSpecialLiquidationCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(StartSpecialLiquidationCommand),
         typeof(StartSpecialLiquidationInternalCommand),
         typeof(GetPriceForSpecialLiquidationTimeoutInternalCommand),
         typeof(ExecuteSpecialLiquidationOrderCommand),
         typeof(FailSpecialLiquidationInternalCommand),
         typeof(ExecuteSpecialLiquidationOrdersInternalCommand),
         typeof(CancelSpecialLiquidationCommand),
         typeof(ClosePositionsRegularFlowCommand),
         typeof(ResumePausedSpecialLiquidationCommand)
         )
     .On(CommandsRoute)
     .WithCommandsHandler <SpecialLiquidationCommandsHandler>()
     .PublishingEvents(
         typeof(SpecialLiquidationStartedInternalEvent),
         typeof(SpecialLiquidationOrderExecutedEvent),
         typeof(SpecialLiquidationOrderExecutionFailedEvent),
         typeof(SpecialLiquidationFinishedEvent),
         typeof(SpecialLiquidationFailedEvent),
         typeof(SpecialLiquidationCancelledEvent),
         typeof(ResumePausedSpecialLiquidationFailedEvent),
         typeof(ResumePausedSpecialLiquidationSucceededEvent)
         )
     .With(EventsRoute);
 }
Example #2
0
 private void RegisterProductCategoriesProjection(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningEvents(
         typeof(ProductCategoryChangedEvent))
     .From(_settings.ContextNames.AssetService).On(nameof(ProductCategoryChangedEvent))
     .WithProjection(
         typeof(ProductCategoryProjection), _settings.ContextNames.AssetService);
 }
Example #3
0
 private void RegisterAccountsProjection(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningEvents(
         typeof(AccountChangedEvent))
     .From(_settings.ContextNames.AccountsManagement).On(EventsRoute)
     .WithProjection(
         typeof(AccountsProjection), _settings.ContextNames.AccountsManagement);
 }
Example #4
0
 private void RegisterMarketStateChangedProjection(ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningEvents(
         typeof(MarketStateChangedEvent))
     .From(_settings.ContextNames.TradingEngine)
     .On(EventsRoute)
     .WithProjection(
         typeof(PlatformClosureProjection), _settings.ContextNames.TradingEngine);
 }
Example #5
0
 private void RegisterMarketSettingsChangedProjection(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningEvents(
         typeof(MarketSettingsChangedEvent))
     .From(_settings.ContextNames.SettingsService)
     .On(nameof(MarketSettingsChangedEvent))
     .WithProjection(
         typeof(MarketSettingsChangedProjection), _settings.ContextNames.SettingsService);
 }
 private static void RegisterStartProductsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration
     .ListeningCommands(typeof(StartProductCommand))
     .On(DefaultRoute)
     .WithCommandsHandler <StartProductsCommandsHandler>()
     .PublishingEvents(typeof(ProductChangedEvent))
     .With(DefaultEventPipeline);
 }
Example #7
0
 private void RegisterAssetPairsProjection(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningEvents(
         typeof(AssetPairChangedEvent))
     .From(_settings.ContextNames.SettingsService)
     .On(EventsRoute)
     .WithProjection(
         typeof(AssetPairProjection), _settings.ContextNames.SettingsService);
 }
 private void RegisterEodProjection(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningEvents(
         typeof(EodProcessStartedEvent))
     .From(_settings.ContextNames.BookKeeper)
     .On(EventsRoute)
     .WithProjection(
         typeof(EodStartedProjection), _settings.ContextNames.BookKeeper);
 }
 private static void RegisterNegativeProtectionCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(NotifyNegativeProtectionInternalCommand))
     .On(DefaultRoute)
     .WithCommandsHandler <NegativeProtectionCommandsHandler>()
     .PublishingEvents(
         typeof(NegativeProtectionEvent))
     .With(DefaultPipeline);
 }
Example #10
0
 private void RegisterWithdrawalCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(FreezeAmountForWithdrawalCommand),
         typeof(UnfreezeMarginOnFailWithdrawalCommand))
     .On(CommandsRoute)
     .WithCommandsHandler <WithdrawalCommandsHandler>()
     .PublishingEvents(
         typeof(AmountForWithdrawalFrozenEvent),
         typeof(AmountForWithdrawalFreezeFailedEvent))
     .With(EventsRoute);
 }
Example #11
0
 private void RegisterDeleteAccountsCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(BlockAccountsForDeletionCommand),
         typeof(MtCoreFinishAccountsDeletionCommand))
     .On(CommandsRoute)
     .WithCommandsHandler <DeleteAccountsCommandsHandler>()
     .PublishingEvents(
         typeof(AccountsBlockedForDeletionEvent),
         typeof(MtCoreDeleteAccountsFinishedEvent))
     .With(EventsRoute);
 }
 private static void RegisterEventPublishing(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.PublishingEvents(typeof(MarketSettingsChangedEvent),
                                          typeof(ProductCategoryChangedEvent),
                                          typeof(CurrencyChangedEvent),
                                          typeof(ProductChangedEvent),
                                          typeof(ClientProfileChangedEvent),
                                          typeof(ClientProfileSettingsChangedEvent),
                                          typeof(TickFormulaChangedEvent),
                                          typeof(AssetTypeChangedEvent)
                                          )
     .With(DefaultEventPipeline);
 }
Example #13
0
 private void RegisterEodCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(CreateSnapshotCommand)
         )
     .On(CommandsRoute)
     .WithCommandsHandler <EodCommandsHandler>()
     .PublishingEvents(
         typeof(SnapshotCreatedEvent),
         typeof(SnapshotCreationFailedEvent)
         )
     .With(EventsRoute);
 }
Example #14
0
 private static void RegisterAssetPairFlagsCommandHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration
     .ListeningCommands(
         typeof(SuspendAssetPairCommand),
         typeof(UnsuspendAssetPairCommand)
         )
     .On(DefaultRoute)
     .WithCommandsHandler <AssetPairFlagsCommandsHandler>()
     .PublishingEvents(
         typeof(AssetPairChangedEvent)
         )
     .With(DefaultPipeline);
 }
 private static void RegisterRevokeTemporaryCapitalCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(StartRevokeTemporaryCapitalInternalCommand),
         typeof(FinishRevokeTemporaryCapitalInternalCommand)
         )
     .On(DefaultRoute)
     .WithCommandsHandler <RevokeTemporaryCapitalCommandsHandler>()
     .PublishingEvents(
         typeof(RevokeTemporaryCapitalStartedInternalEvent),
         typeof(RevokeTemporaryCapitalSucceededEvent),
         typeof(RevokeTemporaryCapitalFailedEvent)
         )
     .With(DefaultPipeline);
 }
 private static void RegisterUpdateBalanceCommandHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration
     .ListeningCommands(
         typeof(UpdateBalanceInternalCommand),
         typeof(ChangeBalanceCommand))
     .On(DefaultRoute)
     .ProcessingOptions(DefaultRoute).MultiThreaded(10).QueueCapacity(1024)
     .WithCommandsHandler <UpdateBalanceCommandsHandler>()
     .PublishingEvents(
         typeof(AccountChangedEvent),
         typeof(AccountBalanceChangeFailedEvent))
     .With(DefaultPipeline)
     .ProcessingOptions(DefaultPipeline).MultiThreaded(10).QueueCapacity(1024);
 }
 private static void RegisterWithdrawalCommandHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(WithdrawCommand),
         typeof(FailWithdrawalInternalCommand),
         typeof(CompleteWithdrawalInternalCommand))
     .On(DefaultRoute)
     .WithCommandsHandler <WithdrawalCommandsHandler>()
     .PublishingEvents(
         typeof(WithdrawalFailedEvent),
         typeof(WithdrawalStartedInternalEvent),
         typeof(WithdrawalStartFailedInternalEvent),
         typeof(WithdrawalSucceededEvent))
     .With(DefaultPipeline);
 }
 private static void RegisterDeleteAccountsCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(DeleteAccountsCommand),
         typeof(MarkAccountsAsDeletedInternalCommand),
         typeof(FinishAccountsDeletionInternalCommand)
         )
     .On(DefaultRoute)
     .WithCommandsHandler <DeleteAccountsCommandsHandler>()
     .PublishingEvents(
         typeof(DeleteAccountsStartedInternalEvent),
         typeof(AccountsMarkedAsDeletedEvent),
         typeof(AccountsDeletionFinishedEvent),
         typeof(AccountChangedEvent)
         )
     .With(DefaultPipeline);
 }
 private static void RegisterDepositCommandHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration
     .ListeningCommands(
         typeof(DepositCommand),
         typeof(FreezeAmountForDepositInternalCommand),
         typeof(FailDepositInternalCommand),
         typeof(CompleteDepositInternalCommand))
     .On(DefaultRoute)
     .WithCommandsHandler <DepositCommandsHandler>()
     .PublishingEvents(
         typeof(DepositFailedEvent),
         typeof(AmountForDepositFrozenInternalEvent),
         typeof(DepositStartedInternalEvent),
         typeof(DepositSucceededEvent))
     .With(DefaultPipeline);
 }
        private void RegisterAssetServiceProjections(
            ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
        {
            contextRegistration.ListeningEvents(typeof(MarketSettingsChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(MarketSettingsChangedEvent)}{_instanceId}")
            .WithProjection(typeof(MarketSettingsChangedProjection), _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(ProductCategoryChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(ProductCategoryChangedEvent)}{_instanceId}")
            .WithProjection(typeof(ProductCategoryChangedProjection), _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(ProductChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(ProductChangedEvent)}{_instanceId}").WithProjection(typeof(ProductChangedProjection),
                                                                              _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(ClientProfileChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(ClientProfileChangedEvent)}{_instanceId}")
            .WithProjection(typeof(ClientProfileChangedProjection), _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(ClientProfileSettingsChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(ClientProfileSettingsChangedEvent)}{_instanceId}")
            .WithProjection(typeof(ClientProfileSettingsChangedProjection), _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(TickFormulaChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(TickFormulaChangedEvent)}{_instanceId}")
            .WithProjection(typeof(TickFormulaChangedProjection), _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(CurrencyChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(CurrencyChangedEvent)}{_instanceId}").WithProjection(typeof(CurrencyChangedProjection),
                                                                               _settings.ContextNames.AssetService);

            contextRegistration.ListeningEvents(typeof(AssetTypeChangedEvent))
            .From(_settings.ContextNames.AssetService)
            .On($"{nameof(AssetTypeChangedEvent)}{_instanceId}").WithProjection(typeof(AssetTypeChangedProjection),
                                                                                _settings.ContextNames.AssetService);
        }
        private void RegisterProjections(ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
        {
            contextRegistration.ListeningEvents(
                typeof(AccountChangedEvent))
            .From(_settings.ContextNames.AccountsManagement).On("events")
            .WithProjection(
                typeof(AccountChangedProjection), _settings.ContextNames.AccountsManagement);

            contextRegistration.ListeningEvents(
                typeof(MarketStateChangedEvent))
            .From(_settings.ContextNames.TradingEngine).On("events")
            .WithProjection(
                typeof(MarketStateChangedProjection), _settings.ContextNames.TradingEngine);

            contextRegistration.ListeningEvents(
                typeof(TaxFileUploadedEvent))
            .From(_settings.ContextNames.BookKeeper).On("events")
            .WithProjection(
                typeof(TaxFileUploadedProjection), _settings.ContextNames.BookKeeper);
        }
Example #22
0
 private void RegisterLiquidationCommandsHandler(
     ProcessingOptionsDescriptor <IBoundedContextRegistration> contextRegistration)
 {
     contextRegistration.ListeningCommands(
         typeof(StartLiquidationInternalCommand),
         typeof(FailLiquidationInternalCommand),
         typeof(FinishLiquidationInternalCommand),
         typeof(LiquidatePositionsInternalCommand),
         typeof(ResumeLiquidationInternalCommand)
         )
     .On(CommandsRoute)
     .WithCommandsHandler <LiquidationCommandsHandler>()
     .PublishingEvents(
         typeof(LiquidationFailedEvent),
         typeof(LiquidationFinishedEvent),
         typeof(LiquidationResumedInternalEvent),
         typeof(LiquidationStartedInternalEvent),
         typeof(NotEnoughLiquidityInternalEvent),
         typeof(PositionsLiquidationFinishedInternalEvent)
         )
     .With(EventsRoute);
 }