-
1. Re: Test message EIP
kcbabo Jan 9, 2014 11:40 AM (in response to jiminaus)If you attach what you have going now, we can help provide advice on where to go.
-
2. Re: Re: Test message EIP
jiminaus Jan 9, 2014 10:01 PM (in response to kcbabo)I've attached the architectural spike I'm working on. I've also attached an image of the pattern I'm trying to implement.
In TestDataGeneratorBean, I have this code where I'm trying to send the test data to the TestDataVerifierService before sending the test message to the ProcessorService.
String correlationId = "123"; String testMessage = "From test data generator"; String expectedOutcome = "In Processor.process1: text=From test data generator."; testDataVerifierService.newTestMessageSent( new TestMessageSentEvent(correlationId, testMessage, expectedOutcome) ); ReferenceInvocation i = processorService.newInvocation(); i.getContext() .setProperty("com.example.switchyard.test_msg_proto.correlationId", "123", Scope.EXCHANGE); try { i.invoke(testMessage); } catch (Exception e) { e.printStackTrace(); }
In TestMessageSeperatorRoute, I've tried to set up this.
from("switchyard://TestMessageSeperator") .choice() .when(header("com.example.switchyard.test_msg_proto.correlationId").isNotNull()) .to("switchyard://TestDataVerifierService?operationName=verify") .otherwise() .to("switchyard://PostProcessorService");
But the test messages always land up at the PostPrcoessorService and never at the TestDataVerifierService.
-
test-msg-proto.zip 10.7 KB
-
test-msg-pattern.png 71.4 KB
-
-
3. Re: Test message EIP
kcbabo Jan 14, 2014 10:13 AM (in response to jiminaus)1 of 1 people found this helpfulThe issue here is that the property is not set on the invocation of TestMessageSeparator. Let me explain why. Right now, you are doing this:
TestDataGeneratorSerivce --(1)--> ProcessorService --(2)--> TestMessageSeperator
There are two message exchanges there, each represented by --(n)-->. In the current app, you are setting the exchange-scoped property in (1), which means it's visible to TestDataGeneratorService and ProcessorService. You are not setting it in (2) however, which means that it's not visible to TestMessageSeparator.
-
4. Re: Re: Test message EIP
kcbabo Jan 14, 2014 2:21 PM (in response to kcbabo)One other thing to keep in mind is that each component in the Test Message pattern doesn't necessarily have to be a service. For example, the message separator can be included inside the application's processing logic to screen out test messages. Whether or not this is appropriate for your case is obviously a decision for you to make, but figured I would bring it up. For laughs, I threw together a new version of the project which uses this approach. Here's what the app looks like:
I have attached the source project if you want to poke around. I added test clients for the SOAP and HTTP bindings so you can push a message through the normal and test paths.
hth,
keith
-
test-message.zip 16.8 KB
-