예제 #1
0
        public override void SetUp()
        {
            _busLogger       = new StorytellerBusLogger();
            _transportLogger = new StorytellerTransportLogger();

            _busLogger.Start(Context);
            _transportLogger.Start(Context, _busLogger.Errors);

            _senderWatcher = new SenderLatchDetected();

            _receiverStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(ConnectionSource.ConnectionString);
                _.DatabaseSchemaName = "receiver";
                _.Storage.Add <PostgresqlEnvelopeStorage>();


                _.Schema.For <TraceDoc>();
            });

            _receiverStore.Advanced.Clean.CompletelyRemoveAll();
            _receiverStore.Schema.ApplyAllConfiguredChangesToDatabase();


            _sendingStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(ConnectionSource.ConnectionString);
                _.DatabaseSchemaName = "sender";

                _.Storage.Add <PostgresqlEnvelopeStorage>();
            });

            _sendingStore.Advanced.Clean.CompletelyRemoveAll();
            _sendingStore.Schema.ApplyAllConfiguredChangesToDatabase();

            _receivers = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new ReceiverApp();
                registry.Logging.LogBusEventsWith(_busLogger);
                registry.Logging.LogTransportEventsWith(_transportLogger);

                return(JasperRuntime.For(registry));
            });

            _senders = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new SenderApp();
                registry.Logging.LogBusEventsWith(_busLogger);
                registry.Logging.LogTransportEventsWith(_transportLogger);

                registry.Logging.LogTransportEventsWith(_senderWatcher);

                return(JasperRuntime.For(registry));
            });
        }
예제 #2
0
        public override void SetUp()
        {
            _messageLogger = new StorytellerMessageLogger(new MessageHistory(), new LoggerFactory(), new NulloMetrics());

            _messageLogger.Start(Context);

            _senderWatcher = new SenderLatchDetected(new LoggerFactory());

            _receiverStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(ConnectionSource.ConnectionString);
                _.DatabaseSchemaName = "receiver";
                _.Storage.Add <PostgresqlEnvelopeStorage>();


                _.Schema.For <TraceDoc>();
            });

            _receiverStore.Advanced.Clean.CompletelyRemoveAll();
            _receiverStore.Schema.ApplyAllConfiguredChangesToDatabase();


            _sendingStore = DocumentStore.For(_ =>
            {
                _.PLV8Enabled = false;
                _.Connection(ConnectionSource.ConnectionString);
                _.DatabaseSchemaName = "sender";

                _.Storage.Add <PostgresqlEnvelopeStorage>();
            });

            _sendingStore.Advanced.Clean.CompletelyRemoveAll();
            _sendingStore.Schema.ApplyAllConfiguredChangesToDatabase();

            _receivers = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new ReceiverApp();
                registry.Services.AddSingleton <IMessageLogger>(_messageLogger);

                return(JasperRuntime.For(registry));
            });

            _senders = new LightweightCache <string, JasperRuntime>(key =>
            {
                var registry = new SenderApp();
                registry.Services.AddSingleton <IMessageLogger>(_messageLogger);

                registry.Services.For <ITransportLogger>().Use(_senderWatcher);

                return(JasperRuntime.For(registry));
            });
        }