예제 #1
0
        public SqlServerCallbackTests()
        {
            // SAMPLE: SqlServer-RebuildMessageStorage
            theRuntime = JasperRuntime.For(_ =>
            {
                _.Settings.PersistMessagesWithSqlServer(ConnectionSource.ConnectionString);
            });

            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 MessagingSettings());



            theCallback = new DurableCallback(theEnvelope, Substitute.For <IWorkerQueue>(), thePersistor, theRetries, logger);
        }
예제 #2
0
        public async Task increment_the_attempt_count_of_incoming_envelope()
        {
            var envelope = ObjectMother.Envelope();

            envelope.Status = TransportConstants.Incoming;

            await thePersistor.StoreIncoming(envelope);

            var prop = ReflectionHelper.GetProperty <Envelope>(x => x.Attempts);

            prop.SetValue(envelope, 3);

            await thePersistor.IncrementIncomingEnvelopeAttempts(envelope);

            var stored = thePersistor.AllIncomingEnvelopes().Single();

            stored.Attempts.ShouldBe(3);
        }