Esempio n. 1
0
        public void Configure(RouterConfiguration routerConfig)
        {
            var settings = routerConfig.Settings.Get <DeduplicationSettings>();

            var inboxDestinationKey = routerConfig.Name;
            var outboxSourceKey     = routerConfig.Name;

            var inboxInstaller           = new InboxInstaller(inboxDestinationKey);
            var inboxPersisterCollection = new InboxPersisterCollection(inboxDestinationKey, settings);

            var outboxInstaller           = new OutboxInstaller(outboxSourceKey);
            var outboxPersisterCollection = new OutboxPersisterCollection(outboxSourceKey, settings);

            var dispatcher = new Dispatcher(settings);

            if (settings.RunInstaller)
            {
                routerConfig.AddModule(new Installer(settings, outboxInstaller, inboxInstaller));
            }

            routerConfig.AddModule(dispatcher);
            routerConfig.AddModule(outboxPersisterCollection);
            routerConfig.AddModule(inboxPersisterCollection);

            routerConfig.AddRule(_ => new CaptureOutgoingMessageRule(settings));
            routerConfig.AddRule(_ => new OutboxRule(outboxPersisterCollection, dispatcher));
            routerConfig.AddRule(_ => new InboxRule(inboxPersisterCollection, settings));
        }
    public async Task PrepareTables()
    {
        LogManager.Use <DefaultFactory>().Level(LogLevel.Debug);

        installer = new OutboxInstaller("S");
        persister = new OutboxPersister(3, "S", "D");
        using (var conn = CreateConnection())
        {
            await conn.OpenAsync().ConfigureAwait(false);

            using (var trans = conn.BeginTransaction())
            {
                await installer.Uninstall("D", conn, trans).ConfigureAwait(false);

                await installer.Install("D", conn, trans).ConfigureAwait(false);

                trans.Commit();
            }
        }
    }
Esempio n. 3
0
 public Installer(DeduplicationSettings settings, OutboxInstaller outboxInstaller, InboxInstaller inboxInstaller)
 {
     this.settings        = settings;
     this.outboxInstaller = outboxInstaller;
     this.inboxInstaller  = inboxInstaller;
 }