use of org.apache.activemq.xbean.XBeanBrokerFactory in project activemq-artemis by apache.
the class RequestReplyNoAdvisoryNetworkTest method testNonAdvisoryNetworkRequestReplyXmlConfig.
public void testNonAdvisoryNetworkRequestReplyXmlConfig() throws Exception {
final String xmlConfigString = new String("<beans" + " xmlns=\"http://www.springframework.org/schema/beans\"" + " xmlns:amq=\"http://activemq.apache.org/schema/core\"" + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xsi:schemaLocation=\"http://www.springframework.org/schema/beans" + " http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" + " http://activemq.apache.org/schema/core" + " http://activemq.apache.org/schema/core/activemq-core.xsd\">" + " <broker xmlns=\"http://activemq.apache.org/schema/core\" id=\"broker\"" + " allowTempAutoCreationOnSend=\"true\" schedulePeriodForDestinationPurge=\"1000\"" + " brokerName=\"%HOST%\" persistent=\"false\" advisorySupport=\"false\" useJmx=\"false\" >" + " <destinationPolicy>" + " <policyMap>" + " <policyEntries>" + " <policyEntry optimizedDispatch=\"true\" gcInactiveDestinations=\"true\" gcWithNetworkConsumers=\"true\" inactiveTimoutBeforeGC=\"1000\">" + " <destination>" + " <tempQueue physicalName=\"" + replyQWildcard.getPhysicalName() + "\"/>" + " </destination>" + " </policyEntry>" + " </policyEntries>" + " </policyMap>" + " </destinationPolicy>" + " <networkConnectors>" + " <networkConnector uri=\"multicast://default\">" + " <staticallyIncludedDestinations>" + " <queue physicalName=\"" + sendQ.getPhysicalName() + "\"/>" + " <tempQueue physicalName=\"" + replyQWildcard.getPhysicalName() + "\"/>" + " </staticallyIncludedDestinations>" + " </networkConnector>" + " </networkConnectors>" + " <transportConnectors>" + " <transportConnector uri=\"tcp://0.0.0.0:0\" discoveryUri=\"multicast://default\" />" + " </transportConnectors>" + " </broker>" + "</beans>");
final String localProtocolScheme = "inline";
URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
if (localProtocolScheme.equalsIgnoreCase(protocol)) {
return new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL u) throws IOException {
return new URLConnection(u) {
@Override
public void connect() throws IOException {
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(xmlConfigString.replace("%HOST%", url.getFile()).getBytes(StandardCharsets.UTF_8));
}
};
}
};
}
return null;
}
});
a = new XBeanBrokerFactory().createBroker(new URI("xbean:" + localProtocolScheme + ":A"));
b = new XBeanBrokerFactory().createBroker(new URI("xbean:" + localProtocolScheme + ":B"));
brokers.add(a);
brokers.add(b);
doTestNonAdvisoryNetworkRequestReply();
}
use of org.apache.activemq.xbean.XBeanBrokerFactory in project activemq-artemis by apache.
the class CreateDestinationsOnStartupViaXBeanTest method createBroker.
@Override
protected BrokerService createBroker() throws Exception {
XBeanBrokerFactory factory = new XBeanBrokerFactory();
BrokerService answer = factory.createBroker(new URI(getBrokerConfigUri()));
// lets disable persistence as we are a test
answer.setPersistent(false);
return answer;
}
Aggregations