protected override void initializeStorage(IJasperHost sender, IJasperHost receiver)
        {
            sender.RebuildMessageStorage();
            receiver.RebuildMessageStorage();


            using (var conn = new SqlConnection(Servers.SqlServerConnectionString))
            {
                conn.Open();

                conn.CreateCommand(@"
IF OBJECT_ID('receiver.item_created', 'U') IS NOT NULL
  drop table receiver.item_created;

").ExecuteNonQuery();

                conn.CreateCommand(@"
create table receiver.item_created
(
	id uniqueidentifier not null
		primary key,
	name varchar(100) not null
);

").ExecuteNonQuery();
            }
        }
Exemple #2
0
        public override void SetUp()
        {
            _envelopes.Clear();
            _nodeLockers.Clear();

            _workers        = new RecordingWorkerQueue();
            _schedulerAgent = new RecordingSchedulingAgent();

            _host = JasperHost.For(_ =>
            {
                _.Settings.PersistMessagesWithSqlServer(Servers.SqlServerConnectionString);

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


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

            _host.Get <IEnvelopePersistence>().Admin.ClearAllPersistedEnvelopes();

            _serializers = _host.Get <MessagingSerializationGraph>();

            _host.RebuildMessageStorage();

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

            _owners["This Node"] = _currentNodeId;
        }
Exemple #3
0
        public override void SetUp()
        {
            theTracker = new Jasper.Messaging.Tracking.MessageTracker();

            var receiverPort = PortFinder.FindPort(3340);
            var senderPort   = PortFinder.FindPort(3370);

            var publishingUri = $"tcp://localhost:{receiverPort}/durable";


            var senderRegistry = new JasperRegistry();

            senderRegistry.Handlers
            .DisableConventionalDiscovery()
            .IncludeType <CascadeReceiver>()
            .IncludeType <ScheduledMessageHandler>();
            senderRegistry.Services.AddSingleton(theTracker);


            senderRegistry.Publish.Message <TriggerMessage>().To(publishingUri);
            senderRegistry.Publish.Message <ItemCreated>().To(publishingUri);
            senderRegistry.Publish.Message <Question>().To(publishingUri);
            senderRegistry.Publish.Message <ScheduledMessage>().To(publishingUri);


            senderRegistry.Transports.DurableListenerAt(senderPort);

            configureSender(senderRegistry);

            theSender = JasperHost.For(senderRegistry);
            theSender.RebuildMessageStorage();


            var receiverRegistry = new JasperRegistry();

            receiverRegistry.Handlers.DisableConventionalDiscovery()
            .IncludeType <TTriggerHandler>()
            .IncludeType <TItemCreatedHandler>()
            .IncludeType <QuestionHandler>()
            .IncludeType <ScheduledMessageHandler>();

            receiverRegistry.Transports.DurableListenerAt(receiverPort);

            receiverRegistry.Handlers.Worker("items").IsDurable()
            .HandlesMessage <ItemCreated>();

            receiverRegistry.Services.AddSingleton(theTracker);

            configureReceiver(receiverRegistry);


            theReceiver = JasperHost.For(receiverRegistry);
            theReceiver.RebuildMessageStorage();


            initializeStorage(theSender, theReceiver);
        }
        protected override void initializeStorage(IJasperHost theSender, IJasperHost theReceiver)
        {
            theSender.RebuildMessageStorage();

            theReceiver.RebuildMessageStorage();

            using (var conn = new NpgsqlConnection(Servers.PostgresConnectionString))
            {
                conn.Open();

                conn.CreateCommand(@"
create table if not exists receiver.item_created
(
	id uuid not null primary key,
	name varchar(100) not null
)
").ExecuteNonQuery();
            }
        }
        protected override void initializeStorage(IJasperHost theSender, IJasperHost theReceiver)
        {
            theSender.RebuildMessageStorage();

            theReceiver.RebuildMessageStorage();
        }