本文整理汇总了Java中org.apache.activemq.broker.BrokerService.setManagementContext方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.setManagementContext方法的具体用法?Java BrokerService.setManagementContext怎么用?Java BrokerService.setManagementContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.BrokerService
的用法示例。
在下文中一共展示了BrokerService.setManagementContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLocalBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void createLocalBroker() throws Exception {
localBroker = new BrokerService();
localBroker.setBrokerName("LOCAL");
localBroker.setUseJmx(true);
localBroker.setSchedulePeriodForDestinationPurge(5000);
ManagementContext managementContext = new ManagementContext();
managementContext.setCreateConnector(false);
localBroker.setManagementContext(managementContext);
PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local");
localBroker.setPersistenceAdapter(persistenceAdapter);
List<TransportConnector> transportConnectors = new ArrayList<>();
DebugTransportFactory tf = new DebugTransportFactory();
TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539"));
TransportConnector transportConnector = new TransportConnector(transport);
transportConnector.setName("tc");
transportConnector.setAuditNetworkProducers(true);
transportConnectors.add(transportConnector);
localBroker.setTransportConnectors(transportConnectors);
}
示例2: createRemoteBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void createRemoteBroker() throws Exception {
remoteBroker = new BrokerService();
remoteBroker.setBrokerName("REMOTE");
remoteBroker.setUseJmx(true);
remoteBroker.setSchedulePeriodForDestinationPurge(5000);
ManagementContext managementContext = new ManagementContext();
managementContext.setCreateConnector(false);
remoteBroker.setManagementContext(managementContext);
PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/remote");
remoteBroker.setPersistenceAdapter(persistenceAdapter);
List<NetworkConnector> networkConnectors = new ArrayList<>();
DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector();
networkConnector.setName("to local");
// set maxInactivityDuration to 0, otherwise the broker restarts while you are in the debugger
networkConnector.setUri(URI.create("static://(tcp://127.0.0.1:23539?wireFormat.maxInactivityDuration=0)"));
networkConnector.setDuplex(true);
//networkConnector.setNetworkTTL(5);
//networkConnector.setDynamicOnly(true);
networkConnector.setAlwaysSyncSend(true);
networkConnector.setDecreaseNetworkConsumerPriority(false);
networkConnector.setPrefetchSize(1);
networkConnector.setCheckDuplicateMessagesOnDuplex(true);
networkConnectors.add(networkConnector);
remoteBroker.setNetworkConnectors(networkConnectors);
}
示例3: createBroker
import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
BrokerService answer = new BrokerService();
answer.setPersistent(isPersistent());
answer.addConnector(bindAddress);
ManagementContext context = new ManagementContext();
context.setConnectorPort(1199);
answer.setManagementContext(context);
return answer;
}