Java Code Examples for org.apache.activemq.broker.BrokerService#setBrokerId()
The following examples show how to use
org.apache.activemq.broker.BrokerService#setBrokerId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AMQ2927Test.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override public void setUp() throws Exception { super.setAutoFail(true); super.setUp(); BrokerService brokerA = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true")); brokerA.setBrokerId("BrokerA"); BrokerService brokerB = createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true")); brokerB.setBrokerId("BrokerB"); NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker, false, 2, true, true); aTOb.addStaticallyIncludedDestination(queue); NetworkConnector bTOa = bridgeBrokers(brokers.get("BrokerB").broker, brokers.get("BrokerA").broker, false, 2, true, true); bTOa.addStaticallyIncludedDestination(queue); startAllBrokers(); waitForBridgeFormation(); }
Example 2
Source File: RequestReplyToTopicViaThreeNetworkHopsTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
public EmbeddedTcpBroker(String name, int number) throws Exception { brokerSvc = new BrokerService(); synchronized (this.getClass()) { brokerNum = Next_broker_num; Next_broker_num++; } brokerName = name + number; brokerId = brokerName; brokerSvc.setBrokerName(brokerName); brokerSvc.setBrokerId(brokerId); brokerSvc.setPersistent(false); brokerSvc.setUseJmx(false); port = 60000 + (brokerNum * 10); tcpUrl = "tcp://127.0.0.1:" + Integer.toString(port); fullUrl = tcpUrl + "?jms.watchTopicAdvisories=false"; brokerSvc.addConnector(tcpUrl); }
Example 3
Source File: EmbeddedActiveMQ.java From james-project with Apache License 2.0 | 6 votes |
private void launchEmbeddedBroker(FileSystem fileSystem) throws Exception { brokerService = new BrokerService(); brokerService.setBrokerName(BROKER_NAME); brokerService.setUseJmx(false); brokerService.setPersistent(true); brokerService.setDataDirectoryFile(fileSystem.getFile(BROCKERS_LOCATION)); brokerService.setUseShutdownHook(false); brokerService.setSchedulerSupport(false); brokerService.setBrokerId(BROKER_ID); String[] uris = {BROCKER_URI}; brokerService.setTransportConnectorURIs(uris); ManagementContext managementContext = new ManagementContext(); managementContext.setCreateConnector(false); brokerService.setManagementContext(managementContext); brokerService.setPersistenceAdapter(persistenceAdapter); BrokerPlugin[] brokerPlugins = {new StatisticsBrokerPlugin()}; brokerService.setPlugins(brokerPlugins); String[] transportConnectorsURIs = {BROCKER_URI}; brokerService.setTransportConnectorURIs(transportConnectorsURIs); brokerService.start(); LOGGER.info("Started embedded activeMq"); }
Example 4
Source File: EmbeddedActiveMQBroker.java From camel-cookbook-examples with Apache License 2.0 | 6 votes |
public EmbeddedActiveMQBroker(String brokerId) { Validate.notEmpty(brokerId, "brokerId is empty"); this.brokerId = brokerId; tcpConnectorUri = "tcp://localhost:" + AvailablePortFinder.getNextAvailable(); brokerService = new BrokerService(); brokerService.setBrokerId(brokerId); brokerService.setPersistent(false); brokerService.setUseJmx(false); try { brokerService.setPersistenceAdapter(new MemoryPersistenceAdapter()); brokerService.addConnector(tcpConnectorUri); } catch (Exception e) { throw new RuntimeException("Problem creating brokerService", e); } }
Example 5
Source File: AMQ2927Test.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void restartBroker(String brokerName) throws Exception { destroyBroker("BrokerA"); BrokerService broker = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false")); broker.setBrokerId("BrokerA"); NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker, false, 2, true, true); aTOb.addStaticallyIncludedDestination(queue); broker.start(); broker.waitUntilStarted(); waitForBridgeFormation(); }
Example 6
Source File: NetworkRouteTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Before public void before() throws Exception { control = EasyMock.createControl(); localBroker = control.createMock(Transport.class); remoteBroker = control.createMock(Transport.class); NetworkBridgeConfiguration configuration = new NetworkBridgeConfiguration(); brokerService = new BrokerService(); BrokerInfo remoteBrokerInfo = new BrokerInfo(); configuration.setDuplex(true); configuration.setNetworkTTL(5); brokerService.setBrokerId("broker-1"); brokerService.setPersistent(false); brokerService.setUseJmx(false); brokerService.start(); brokerService.waitUntilStarted(); remoteBrokerInfo.setBrokerId(new BrokerId("remote-broker-id")); remoteBrokerInfo.setBrokerName("remote-broker-name"); localBroker.setTransportListener(EasyMock.isA(TransportListener.class)); ArgHolder localListenerRef = ArgHolder.holdArgsForLastVoidCall(); remoteBroker.setTransportListener(EasyMock.isA(TransportListener.class)); ArgHolder remoteListenerRef = ArgHolder.holdArgsForLastVoidCall(); localBroker.start(); remoteBroker.start(); remoteBroker.oneway(EasyMock.isA(Object.class)); EasyMock.expectLastCall().times(4); remoteBroker.oneway(EasyMock.isA(Object.class)); ExpectationWaiter remoteInitWaiter = ExpectationWaiter.waiterForLastVoidCall(); localBroker.oneway(remoteBrokerInfo); EasyMock.expect(localBroker.request(EasyMock.isA(Object.class))).andReturn(null); localBroker.oneway(EasyMock.isA(Object.class)); ExpectationWaiter localInitWaiter = ExpectationWaiter.waiterForLastVoidCall(); control.replay(); DurableConduitBridge bridge = new DurableConduitBridge(configuration, localBroker, remoteBroker); bridge.setBrokerService(brokerService); bridge.start(); localListener = (TransportListener) localListenerRef.getArguments()[0]; Assert.assertNotNull(localListener); remoteListener = (TransportListener) remoteListenerRef.getArguments()[0]; Assert.assertNotNull(remoteListener); remoteListener.onCommand(remoteBrokerInfo); remoteInitWaiter.assertHappens(5, TimeUnit.SECONDS); localInitWaiter.assertHappens(5, TimeUnit.SECONDS); control.verify(); control.reset(); ActiveMQMessage msg = new ActiveMQMessage(); msg.setDestination(new ActiveMQTopic("test")); msgDispatch = new MessageDispatch(); msgDispatch.setMessage(msg); ConsumerInfo path1 = new ConsumerInfo(); path1.setDestination(msg.getDestination()); path1.setConsumerId(new ConsumerId(new SessionId(new ConnectionId("conn-id-1"), 1), 3)); path1.setBrokerPath(new BrokerId[]{new BrokerId("remote-broker-id"), new BrokerId("server(1)-broker-id"),}); path1Msg = new ActiveMQMessage(); path1Msg.setDestination(AdvisorySupport.getConsumerAdvisoryTopic(path1.getDestination())); path1Msg.setDataStructure(path1); ConsumerInfo path2 = new ConsumerInfo(); path2.setDestination(path1.getDestination()); path2.setConsumerId(new ConsumerId(new SessionId(new ConnectionId("conn-id-2"), 2), 4)); path2.setBrokerPath(new BrokerId[]{new BrokerId("remote-broker-id"), new BrokerId("server(2)-broker-id"), new BrokerId("server(1)-broker-id"),}); path2Msg = new ActiveMQMessage(); path2Msg.setDestination(path1Msg.getDestination()); path2Msg.setDataStructure(path2); RemoveInfo removePath1 = new RemoveInfo(path1.getConsumerId()); RemoveInfo removePath2 = new RemoveInfo(path2.getConsumerId()); removePath1Msg = new ActiveMQMessage(); removePath1Msg.setDestination(path1Msg.getDestination()); removePath1Msg.setDataStructure(removePath1); removePath2Msg = new ActiveMQMessage(); removePath2Msg.setDestination(path1Msg.getDestination()); removePath2Msg.setDataStructure(removePath2); }
Example 7
Source File: ThreeBrokerQueueNetworkTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override public void configureBroker(BrokerService brokerService) { brokerService.setBrokerId(brokerService.getBrokerName()); }
Example 8
Source File: ThreeBrokerTopicNetworkTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override protected void configureBroker(BrokerService broker) { broker.setBrokerId(broker.getBrokerName()); }