1 18 package org.apache.activemq.usecases; 19 20 import org.apache.activemq.command.ActiveMQTopic; 21 import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; 22 23 import javax.jms.Destination ; 24 import javax.jms.Message ; 25 26 29 public class CompositeConsumeTest extends JmsTopicSendReceiveWithTwoConnectionsTest { 30 31 public void testSendReceive() throws Exception { 32 messages.clear(); 33 34 Destination [] destinations = getDestinations(); 35 int destIdx = 0; 36 37 for (int i = 0; i < data.length; i++) { 38 Message message = session.createTextMessage(data[i]); 39 40 if (verbose) { 41 log.info("About to send a message: " + message + " with text: " + data[i]); 42 } 43 44 producer.send(destinations[destIdx], message); 45 46 if (++destIdx >= destinations.length) { 47 destIdx = 0; 48 } 49 } 50 51 assertMessagesAreReceived(); 52 } 53 54 57 protected String getSubject() { 58 return getPrefix() + "FOO.BAR," + getPrefix() + "FOO.X.Y," + getPrefix() + "BAR.>"; 59 } 60 61 64 protected Destination [] getDestinations() { 65 return new Destination []{new ActiveMQTopic(getPrefix() + "FOO.BAR"), new ActiveMQTopic(getPrefix() + "BAR.WHATNOT.XYZ"), new ActiveMQTopic(getPrefix() + "FOO.X.Y")}; 66 } 67 68 protected String getPrefix() { 69 return super.getSubject() + "."; 70 } 71 } 72 | Popular Tags |