1 18 package org.apache.activemq.systest.usecase.network; 19 20 import org.apache.activemq.systest.BrokerAgent; 21 import org.apache.activemq.systest.ConsumerAgent; 22 import org.apache.activemq.systest.MessageList; 23 import org.apache.activemq.systest.ProducerAgent; 24 25 29 public class TwoBrokerNetworkScenario extends ProducerConsumerScenarioSupport { 30 31 protected BrokerAgent brokerA; 32 protected BrokerAgent brokerB; 33 34 public TwoBrokerNetworkScenario(BrokerAgent brokera, BrokerAgent brokerb, ProducerAgent producer, 35 ConsumerAgent consumer, MessageList list) { 36 super(producer, consumer, list); 37 brokerA = brokera; 38 brokerB = brokerb; 39 } 40 41 public void run() throws Exception { 42 producer.sendMessages(messageList); 43 consumer.assertConsumed(messageList); 44 } 45 46 public void start() throws Exception { 47 startBrokers(); 48 49 consumer.connectTo(brokerB); 50 producer.connectTo(brokerA); 51 52 super.start(); 53 54 Thread.sleep(1000); 56 } 57 58 protected void startBrokers() throws Exception { 59 start(brokerA); 60 start(brokerB); 61 62 brokerB.connectTo(brokerA); 63 brokerA.connectTo(brokerB); 64 } 65 } 66 | Popular Tags |