public DomainMessageProcessingContext( DomainMessageProcessor.Retries retries, MessageHeader messageHeader, MessageEndpointName sourceQueue) { Retries = retries; MessageHeader = messageHeader; SourceQueue = sourceQueue; }
public MessageEndpointState( HttpChannel channel, long lastSuccessfullyProcessedMessage, MessageEndpointName endpointName) { Channel = channel; LastSuccessfullyProcessedMessage = lastSuccessfullyProcessedMessage; EndpointName = endpointName; }
public static Option <Tuple <long, MessageQueueProcessingDetailsRow> > GetLastProcessedMessageNumber( UnitOfWork uow, MessageEndpointName queueName) { var getQuery = @"SELECT ""Id"", ""QueueName"", ""LastMessageNumber"", ""Version"", ""UpdatedTimestamp"" from ""MessageQueueProcessingDetails"" where ""QueueName"" = @queueName"; object queryParameters = new { QueueName = queueName.Value }; Option <MessageQueueProcessingDetailsRow> result2 = DbRepository.GetSingle <MessageQueueProcessingDetailsRow>(getQuery, queryParameters, uow); return(result2.Map(r => new Tuple <long, MessageQueueProcessingDetailsRow>(r.LastMessageNumber, r))); }
internal static void InsertOrUpdateLastProcessedMessage( UnitOfWork uow, MessageEndpointName queueName, long messageNumber, Option <MessageQueueProcessingDetailsRow> option) { option.Match( x => { x.LastMessageNumber = messageNumber; UpdateLastProcessedMessage(uow, x); }, () => { InsertLastProcessedMessage(uow, messageNumber, queueName); } ); }
public void Handle( T evt, MessageEndpointName queueName, long messageNumber) { Option <Tuple <long, MessageQueueProcessingDetailsRow> > lastProcessedMessage = MessageNumberRepository.GetLastProcessedMessageNumber(_uow, queueName); if (IsNewMessage(lastProcessedMessage, messageNumber)) { MessageNumberRepository.InsertOrUpdateLastProcessedMessage( _uow, queueName, messageNumber, lastProcessedMessage.Select(x => x.Item2)); _next(evt); } }
public static void InsertLastProcessedMessage( UnitOfWork uow, long messageNumber, MessageEndpointName queueName) { MessageQueueProcessingDetailsRow d = new MessageQueueProcessingDetailsRow() { Id = Guid.NewGuid(), LastMessageNumber = messageNumber, QueueName = queueName.Value, Version = 0, UpdatedTimestamp = DateTimeOffset.UtcNow }; int rowsInserted = uow.DbConnection.Execute( InsertStatement, d, uow.Transaction); }
public static List <MessageEndpoint> GetAll(UnitOfWork uow) { var channelBase = OrderChannel.GetBase(); var messageEndpointName = new MessageEndpointName("orderdomain/order stream #1"); var lastMessageProcessed = MessageNumberRepository.GetLastProcessedMessageNumber( uow, messageEndpointName); var lmp = lastMessageProcessed.Match(x => x.Item1, () => MessageEndpoint.NoMessagesProcessed); return(new List <MessageEndpoint>() { new MessageEndpoint( messageEndpointName, new HttpChannel( channelBase, "eventstream/orderdomain/order/0,9"), lmp, PollingDelays.DefaultDelayMs * 5, PollingDelays.DefaultPollingErrorDelays) }); }
public void Null_Equality_Tests() { MessageEndpointName endpointName = new MessageEndpointName("abc"); MessageEndpointName endpointName2 = new MessageEndpointName("abc"); // Check for null Assert.IsFalse(endpointName.Equals(null)); // Null's all round: Yuck. // a null MessageEndpointName equals another null MessageEndpointName. // (If interpreted as saying one non-existence is the same as another // non-existencce this is probably what we want, but is it really // philosophically right to say that one non-existence is the same // as another? In fact, does it even make sense to ask the question...) MessageEndpointName nullStream1 = null; MessageEndpointName nullStream2 = null; Assert.IsTrue(nullStream1 == nullStream2); // I'm philosophically opposed to this, but in C# different types of null's are equal... :-) object somethingElseEntirely = null; Assert.IsTrue(nullStream1 == somethingElseEntirely); }