public void testDefaultResequencerProperties() { EventDrivenConsumer endpoint = (EventDrivenConsumer)context.GetObject("defaultResequencer"); Resequencer resequencer = (Resequencer)TestUtils.GetFieldValue(endpoint, "_handler"); Assert.IsNull(TestUtils.GetFieldValue(resequencer, "_outputChannel")); Assert.IsNull(TestUtils.GetFieldValue(resequencer, "_discardChannel")); MessageChannelTemplate channelTemplate = (MessageChannelTemplate)TestUtils.GetFieldValue(resequencer, "_channelTemplate"); Assert.That(TestUtils.GetFieldValue(channelTemplate, "_sendTimeout"), Is.EqualTo(TimeSpan.FromMilliseconds(1000l)), "The ResequencerEndpoint is not set with the appropriate timeout value"); Assert.That(TestUtils.GetFieldValue(resequencer, "_sendPartialResultOnTimeout"), Is.EqualTo(false), "The ResequencerEndpoint is not configured with the appropriate 'send partial results on timeout' flag"); Assert.That(TestUtils.GetFieldValue(resequencer, "_reaperInterval"), Is.EqualTo(TimeSpan.FromMilliseconds(1000l)), "The ResequencerEndpoint is not configured with the appropriate reaper interval"); Assert.That(TestUtils.GetFieldValue(resequencer, "_trackedCorrelationIdCapacity"), Is.EqualTo(1000), "The ResequencerEndpoint is not configured with the appropriate tracked correlationId capacity"); Assert.That(TestUtils.GetFieldValue(resequencer, "_timeout"), Is.EqualTo(TimeSpan.FromMilliseconds(60000l)), "The ResequencerEndpoint is not configured with the appropriate timeout"); Assert.That(TestUtils.GetFieldValue(resequencer, "_releasePartialSequences"), Is.EqualTo(true), "The ResequencerEndpoint is not configured with the appropriate 'release partial sequences' flag"); }
public void testPropertyAssignment() { EventDrivenConsumer endpoint = (EventDrivenConsumer)context.GetObject("completelyDefinedResequencer"); IMessageChannel outputChannel = (IMessageChannel)context.GetObject("outputChannel"); IMessageChannel discardChannel = (IMessageChannel)context.GetObject("discardChannel"); Resequencer resequencer = (Resequencer)TestUtils.GetFieldValue(endpoint, "_handler"); Assert.That(TestUtils.GetFieldValue(resequencer, "_outputChannel"), Is.EqualTo(outputChannel), "The ResequencerEndpoint is not injected with the appropriate output channel"); Assert.That(TestUtils.GetFieldValue(resequencer, "_discardChannel"), Is.EqualTo(discardChannel), "The ResequencerEndpoint is not injected with the appropriate discard channel"); MessageChannelTemplate channelTemplate = (MessageChannelTemplate)TestUtils.GetFieldValue(resequencer, "_channelTemplate"); Assert.That(TestUtils.GetFieldValue(channelTemplate, "_sendTimeout"), Is.EqualTo(TimeSpan.FromMilliseconds(86420000l)), "The ResequencerEndpoint is not set with the appropriate timeout value"); Assert.That(TestUtils.GetFieldValue(resequencer, "_sendPartialResultOnTimeout"), Is.EqualTo(true), "The ResequencerEndpoint is not configured with the appropriate 'send partial results on timeout' flag"); Assert.That(TestUtils.GetFieldValue(resequencer, "_reaperInterval"), Is.EqualTo(TimeSpan.FromMilliseconds(135l)), "The ResequencerEndpoint is not configured with the appropriate reaper interval"); Assert.That(TestUtils.GetFieldValue(resequencer, "_trackedCorrelationIdCapacity"), Is.EqualTo(99), "The ResequencerEndpoint is not configured with the appropriate tracked correlationId capacity"); Assert.That(TestUtils.GetFieldValue(resequencer, "_timeout"), Is.EqualTo(TimeSpan.FromMilliseconds(42l)), "The ResequencerEndpoint is not configured with the appropriate timeout"); Assert.That(TestUtils.GetFieldValue(resequencer, "_releasePartialSequences"), Is.EqualTo(false), "The ResequencerEndpoint is not configured with the appropriate 'release partial sequences' flag"); }
public static ProcessorBuilder<MessagePayload> ToResequencerIfSequenced( this ProcessorBuilder<MessagePayload> builder, ReceiveMessageCache messageCache, ISequenceOptionSchema schema) { IMessageProcessor<MessagePayload, MessagePayload> processor; if(schema.IsSequenced) processor = new Resequencer(messageCache); else processor = new MessageDecacher(messageCache); return builder.ToProcessor(processor); }