Пример #1
0
        public SqlServerCallbackTests()
        {
            // SAMPLE: SqlServer-RebuildMessageStorage
            theRuntime = JasperRuntime.For(_ =>
            {
                _.Settings.PersistMessagesWithSqlServer(Servers.SqlServerConnectionString);
            });

            theRuntime.RebuildMessageStorage();
            // ENDSAMPLE

            theEnvelope        = ObjectMother.Envelope();
            theEnvelope.Status = TransportConstants.Incoming;


            thePersistor = theRuntime.Get <SqlServerEnvelopePersistor>();
            thePersistor.StoreIncoming(theEnvelope).Wait(3.Seconds());


            var logger = TransportLogger.Empty();

            theRetries = new EnvelopeRetries(thePersistor, logger, new JasperOptions());


            theCallback = new DurableCallback(theEnvelope, Substitute.For <IWorkerQueue>(), thePersistor, theRetries,
                                              logger);
        }
Пример #2
0
        public MartenCallbackTests()
        {
            theRuntime = JasperRuntime.For(_ =>
            {
                _.MartenConnectionStringIs(Servers.PostgresConnectionString);

                _.ConfigureMarten(x =>
                {
                    x.Storage.Add <PostgresqlEnvelopeStorage>();
                    x.PLV8Enabled = false;
                });
            });

            theStore = theRuntime.Get <IDocumentStore>();

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

            theEnvelope        = ObjectMother.Envelope();
            theEnvelope.Status = TransportConstants.Incoming;

            var marker = new EnvelopeTables(new MessagingSettings(), new StoreOptions());

            using (var session = theStore.OpenSession())
            {
                session.StoreIncoming(marker, theEnvelope);
                session.SaveChanges();
            }


            var logger = TransportLogger.Empty();

            theRetries = new EnvelopeRetries(new MartenEnvelopePersistor(theStore, marker), logger,
                                             new MessagingSettings());


            var persistor = new MartenEnvelopePersistor(theStore, marker);

            theCallback =
                new DurableCallback(theEnvelope, Substitute.For <IWorkerQueue>(), persistor, theRetries, logger);
        }