Esempio n. 1
0
        protected DatabaseBackedEnvelopePersistence(DatabaseSettings settings, JasperOptions options, IEnvelopeStorageAdmin admin, IDurabilityAgentStorage agentStorage)
        {
            this.settings = settings;
            Admin         = admin;
            AgentStorage  = agentStorage;

            _options      = options;
            _cancellation = options.Cancellation;

            _incrementIncomingAttempts = $"update {this.settings.SchemaName}.{IncomingTable} set attempts = @attempts where id = @id";
            _storeIncoming             = $@"
insert into {this.settings.SchemaName}.{IncomingTable}
  (id, status, owner_id, execution_time, attempts, body)
values
  (@id, @status, @owner, @time, @attempts, @body);
";
            _insertOutgoingSql         = $"insert into {this.settings.SchemaName}.{OutgoingTable} (id, owner_id, destination, deliver_by, body) values (@id, @owner, @destination, @deliverBy, @body)";
        }
        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;
        }
Esempio n. 3
0
        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;
        }