Ejemplo n.º 1
0
        private static IReceiver CreateRetryReceiver(IConfig config, IRegistry registry)
        {
            var r = new DatastoreReceiver(
                registry.CreateDatastoreContext,
                ctx => ctx.RetryReliability.Where(
                    rr => rr.Status == RetryStatus.Pending &&
                    (rr.LastRetryTime.HasValue == false ||
                     DateTimeOffset.Now >= rr.LastRetryTime.Value.Add(rr.RetryInterval))).ToList());

            r.Configure(new DatastoreReceiverSettings(
                            tableName: "RetryReliability",
                            filter: "Status = 'Pending' AND Now >= LastRetryTime + RetryInterval",
                            updateField: "Status",
                            updateValue: "Busy",
                            pollingInterval: config.RetryPollingInterval));
            return(r);
        }
Ejemplo n.º 2
0
        public void ReceivesOutMessage()
        {
            // Arrange
            Stream       expectedStream = Stream.Null;
            const string expectedType   = Constants.ContentTypes.Soap;

            ArrangeOutMessageInDatastore(Operation.ToBeDelivered, expectedStream, expectedType);

            var receiver = new DatastoreReceiver(GetDataStoreContext);

            var settings = new DatastoreReceiverSettings("OutMessages", "Operation = \'ToBeDelivered\'", "Operation", "Sending");

            receiver.Configure(settings);

            // Act
            ReceivedMessage actualMessage = StartReceiver(receiver);

            // Assert
            Assert.Equal(expectedStream, actualMessage.UnderlyingStream);
            Assert.Equal(expectedType, actualMessage.ContentType);
        }