I have been trying the AMQ and Camel list, with limited success on trying to get a working Unit Test.
Here is what I am trying to do:
1. Have a server side service that sends a status update to a Virtual Topic
2. Create multiple MDP's that I can unit test multiple Consumer clients subscribing to a durable Queue.
3. Have my Virtual Topic forward messages to each Consumer Queue
My main issue:
* I can Produce a message to my VirtualTopic but the message is never forwarded to the Consumer Queues.
* If I have my Consumer (singular) listen to my VirtualTopic, then I can get the message from that queue.
* If I produce a message to the Consumer Queue, the message arrives at the client.
* I can not understand how to create multiple MDP's to test in the same Unit test.
as for the 1st issue above...... I can not seem to get the embedded activeMQ to forward my requests, and this is how I configure it:
I tried what you suggested with this Broker:
Code:<broker xmlns="http://activemq.apache.org/schema/core"> <transportConnectors> <transportConnector name="tcp" uri="tcp://localhost:61616" /> </transportConnectors> <destinationInterceptors> <virtualDestinationInterceptor> <virtualDestinations> <compositeTopic name="VirtualTopic.TEST"> <forwardTo> <topic physicalName="Consumer.A.VirtualTopic.TEST" /> </forwardTo> </compositeTopic> </virtualDestinations> </virtualDestinationInterceptor> </destinationInterceptors> </broker>
And then I was sending messages to both the Topic, and the resulting que to determin what was getting through:
But only the last message arrives at my MDP which is the one directly to the Consumer itself. The 1st 2 did not arrive as expected:Code://Send message to producer.sendBody(body+"XXXXXXXXXXXXXXX"+body); producer.sendBodyAndHeader("activemq:VirtualTopic.TEST", body+body+body, "foo", "bar"); producer.sendBodyAndHeader("activemq:Consumer.A.VirtualTopic.TEST", body+"OOOOOOOOOOOO"+body, "foo", "bar");
I actually zipped up the source here:Code:[myproject] INFO [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] StatusUpdateService.onMessage(17) | //----------------------------- ------------------------------// [myproject] INFO [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] StatusUpdateService.onMessage(18) | //----------------------------- ------------------------------// [myproject] INFO [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] StatusUpdateService.onMessage(19) | //----------------------------- ------------------------------// [myproject] INFO [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] StatusUpdateService.onMessage(20) | //----------------------------- ------------------------------// [myproject] INFO [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] StatusUpdateService.onMessage(21) | //----------------------------- ------------------------------// [myproject] INFO [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1] StatusUpdateService.onMessage(22) | //----------------------------- ------------------------------// ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId = ID:L83601HY-3296-1250007358494-2:4:1:1:1, originalDestination = null, originalTran sactionId = null, producerId = ID:L83601HY-3296-1250007358494-2:4:1:1, destination = queue://Consumer.A.VirtualTopic.TEST, transactionId = null, expiration = 0, timestamp = 1250007383823, arrival = 0, brokerInTime = 1250007383823, brokerOutTime = 1250007383823, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshall edProperties = org.apache.activemq.util.ByteSequence@16d3536, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {foo=bar}, readOnlyProper ties = true, readOnlyBody = true, droppable = false, text = 33OOOOOOOOOOOO33}
http://baselogic.com/temp/services.zip
It should run on its own if you want to see my issue. I cd into the table-service-su DIR and run:
mvn camel:run -e in one cmd prompt.
Then in another one, I run mvn verify -e to run the unit tests.


Reply With Quote