public MartenBackedListenerContext()
        {
            theStore = DocumentStore.For(_ =>
            {
                _.Connection(Servers.PostgresConnectionString);
                _.PLV8Enabled = false;
            });


            theSettings = new AdvancedSettings(null);


            EnvelopeStorageAdmin.RebuildSchemaObjects();

            var persistence =
                new PostgresqlEnvelopePersistence(
                    new PostgresqlSettings {
                ConnectionString = Servers.PostgresConnectionString
            }, theSettings);

            thePipeline    = Substitute.For <IHandlerPipeline>();
            theWorkerQueue = new DurableWorkerQueue(new LocalQueueSettings("temp"), thePipeline, theSettings,
                                                    persistence, TransportLogger.Empty());


            var agent = Substitute.For <IListener>();

            theWorkerQueue.StartListening(agent);
        }
        public override void SetUp()
        {
            _envelopes.Clear();
            _nodeLockers.Clear();

            _workers = new RecordingWorkerQueue();

            _host = JasperHost.CreateDefaultBuilder()
                    .UseJasper(_ =>
            {
                _.ServiceName = Guid.NewGuid().ToString();

                _.MartenConnectionStringIs(Servers.PostgresConnectionString);

                _.Services.AddSingleton <IWorkerQueue>(_workers);

                _.Include <MartenBackedPersistence>();

                _.Settings.Alter <JasperOptions>(x =>
                {
                    x.Retries.FirstNodeReassignmentExecution = 30.Minutes();
                    x.ScheduledJobs.FirstExecution           = 30.Minutes();
                    x.Retries.FirstNodeReassignmentExecution = 30.Minutes();
                    x.Retries.NodeReassignmentPollingTime    = 30.Minutes();
                });
            })
                    .StartJasper();


            _admin = _host.Get <IEnvelopePersistence>().Admin;
            _admin.RebuildSchemaObjects();

            _settings    = _host.Get <PostgresqlSettings>();
            _serializers = _host.Get <MessagingSerializationGraph>();

            theStore = _host.Get <IDocumentStore>();
            theStore.Advanced.Clean.DeleteAllDocuments();

            _currentNodeId = _host.Get <JasperOptions>().UniqueNodeId;

            _owners["This Node"] = _currentNodeId;
        }
        public override void SetUp()
        {
            _envelopes.Clear();
            _nodeLockers.Clear();

            _workers = new RecordingWorkerQueue();

            _host = Host.CreateDefaultBuilder()
                    .UseJasper(_ =>
            {
                _.ServiceName = Guid.NewGuid().ToString();

                _.Endpoints.As <TransportCollection>().Add(new StubTransport());

                _.Extensions.UseMarten(Servers.PostgresConnectionString);

                _.Services.AddSingleton <IWorkerQueue>(_workers);


                _.Advanced.FirstNodeReassignmentExecution = 30.Minutes();
                _.Advanced.ScheduledJobFirstExecution     = 30.Minutes();
                _.Advanced.FirstNodeReassignmentExecution = 30.Minutes();
                _.Advanced.NodeReassignmentPollingTime    = 30.Minutes();
            })
                    .Start();


            _admin = _host.Services.GetService <IEnvelopePersistence>().Admin;
            _admin.RebuildSchemaObjects();

            _settings    = _host.Services.GetService <PostgresqlSettings>();
            _serializers = _host.Services.GetService <MessagingSerializationGraph>();

            theStore = _host.Services.GetService <IDocumentStore>();
            theStore.Advanced.Clean.DeleteAllDocuments();

            _currentNodeId = _host.Services.GetService <AdvancedSettings>().UniqueNodeId;

            _owners["This Node"] = _currentNodeId;
        }
示例#4
0
        public MartenBackedListenerContext()
        {
            theStore = DocumentStore.For(_ =>
            {
                _.Connection(Servers.PostgresConnectionString);
                _.PLV8Enabled = false;
            });


            theWorkerQueue = Substitute.For <IWorkerQueue>();

            theOptions = new JasperOptions();


            EnvelopeStorageAdmin.RebuildSchemaObjects();


            theListener = new DurableListener(
                Substitute.For <IListeningAgent>(),
                theWorkerQueue,
                TransportLogger.Empty(), theOptions, new PostgresqlEnvelopePersistence(new PostgresqlSettings {
                ConnectionString = Servers.PostgresConnectionString
            }, theOptions));
        }