本文整理汇总了Java中org.apache.activemq.artemis.core.server.ActiveMQServer类的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQServer类的具体用法?Java ActiveMQServer怎么用?Java ActiveMQServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActiveMQServer类属于org.apache.activemq.artemis.core.server包,在下文中一共展示了ActiveMQServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildArtemisBroker
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
public ActiveMQServer buildArtemisBroker() throws IOException {
Configuration configuration = new ConfigurationImpl();
configuration.setPersistenceEnabled(true);
configuration.setSecurityEnabled(false);
Map<String, Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(
org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, 61400);
configuration.setBindingsDirectory(storeFolder.newFolder().getAbsolutePath());
configuration.setJournalDirectory(storeFolder.newFolder().getAbsolutePath());
configuration.setLargeMessagesDirectory(storeFolder.newFolder().getAbsolutePath());
configuration.setPagingDirectory(storeFolder.newFolder().getAbsolutePath());
configuration.addAcceptorConfiguration(
new TransportConfiguration(NettyAcceptorFactory.class.getName(), connectionParams));
configuration.addConnectorConfiguration("connector",
new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams));
return new ActiveMQServerImpl(configuration);
}
开发者ID:apache,项目名称:activemq-cli-tools,代码行数:24,代码来源:ExporterTest.java
示例2: start
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
public void start() throws Exception {
org.apache.activemq.artemis.core.config.Configuration configuration = new ConfigurationImpl();
HashSet<TransportConfiguration> transports = new HashSet<>();
transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
configuration.setAcceptorConfigurations(transports);
configuration.setSecurityEnabled(false);
File targetDir = new File(System.getProperty("user.dir") + "/target");
configuration.setBrokerInstance(targetDir);
ActiveMQServer temp = new ActiveMQServerImpl(configuration);
temp.start();
server = temp;
}
开发者ID:opentracing-contrib,项目名称:java-spring-cloud,代码行数:17,代码来源:JmsArtemisManualServerTest.java
示例3: getScaleDownConnector
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
public static ServerLocatorInternal getScaleDownConnector(ScaleDownPolicy scaleDownPolicy,
ActiveMQServer activeMQServer) throws ActiveMQException {
if (!scaleDownPolicy.getConnectors().isEmpty()) {
return (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(connectorNameListToArray(scaleDownPolicy.getConnectors(), activeMQServer));
} else if (scaleDownPolicy.getDiscoveryGroup() != null) {
DiscoveryGroupConfiguration dg = activeMQServer.getConfiguration().getDiscoveryGroupConfigurations().get(scaleDownPolicy.getDiscoveryGroup());
if (dg == null) {
throw ActiveMQMessageBundle.BUNDLE.noDiscoveryGroupFound(dg);
}
return (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(dg);
} else {
Map<String, TransportConfiguration> connectorConfigurations = activeMQServer.getConfiguration().getConnectorConfigurations();
for (TransportConfiguration transportConfiguration : connectorConfigurations.values()) {
if (transportConfiguration.getFactoryClassName().equals(InVMConnectorFactory.class.getName())) {
return (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(transportConfiguration);
}
}
}
throw ActiveMQMessageBundle.BUNDLE.noConfigurationFoundForScaleDown();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:ScaleDownPolicy.java
示例4: testGlobalBlockLogging
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testGlobalBlockLogging() throws Exception {
final int MAX_MESSAGES = 200;
final String MY_ADDRESS = "myAddress";
final String MY_QUEUE = "myQueue";
ActiveMQServer server = createServer(false);
AddressSettings defaultSetting = new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
server.getAddressSettingsRepository().addMatch("#", defaultSetting);
server.getConfiguration().setGlobalMaxSize(20 * 1024);
server.start();
internalTest(MAX_MESSAGES, MY_ADDRESS, MY_QUEUE, server);
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:AddressFullLoggingTest.java
示例5: testCreateSessionWithNullUserPass
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testCreateSessionWithNullUserPass() throws Exception {
ActiveMQServer server = createServer();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("guest", "guest");
securityManager.getConfiguration().setDefaultUser("guest");
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
try {
ClientSession session = cf.createSession(false, true, true);
session.close();
} catch (ActiveMQException e) {
Assert.fail("should not throw exception");
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:SecurityTest.java
示例6: testCreateSessionWithCorrectUserCorrectPass
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testCreateSessionWithCorrectUserCorrectPass() throws Exception {
ActiveMQServer server = createServer();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("newuser", "apass");
server.start();
ClientSessionFactory cf = createSessionFactory(locator);
try {
ClientSession session = cf.createSession("newuser", "apass", false, true, true, false, -1);
session.close();
} catch (ActiveMQException e) {
Assert.fail("should not throw exception");
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:SecurityTest.java
示例7: fail
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
public static void fail(TransportConfiguration tc) {
// only kill one server
if (stopCount == 0) {
try {
for (ActiveMQServer activeMQServer : staticServers) {
if (activeMQServer != null) {
for (TransportConfiguration transportConfiguration : activeMQServer.getConfiguration().getAcceptorConfigurations()) {
if (transportConfiguration.getParams().get(TransportConstants.PORT_PROP_NAME).equals(tc.getParams().get(TransportConstants.PORT_PROP_NAME))) {
activeMQServer.stop();
stopCount++;
System.out.println("Stopping server listening at: " + tc.getParams().get(TransportConstants.PORT_PROP_NAME));
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:ScaleDownFailoverTest.java
示例8: testCreateDurableQueueWithoutRole
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testCreateDurableQueueWithoutRole() throws Exception {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>();
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.getConfiguration().addRole("auser", "arole");
ClientSessionFactory cf = createSessionFactory(locator);
ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
try {
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
Assert.fail("should throw exception");
} catch (ActiveMQSecurityException se) {
//ok
} catch (ActiveMQException e) {
fail("Invalid Exception type:" + e.getType());
}
session.close();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:SecurityTest.java
示例9: testDeleteDurableQueueWithoutRole
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testDeleteDurableQueueWithoutRole() throws Exception {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>();
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.getConfiguration().addRole("auser", "arole");
ClientSessionFactory cf = createSessionFactory(locator);
ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
try {
session.deleteQueue(SecurityTest.queueA);
Assert.fail("should throw exception");
} catch (ActiveMQSecurityException se) {
//ok
} catch (ActiveMQException e) {
fail("Invalid Exception type:" + e.getType());
}
session.close();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:SecurityTest.java
示例10: testCreateTempQueueWithoutRole
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testCreateTempQueueWithoutRole() throws Exception {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>();
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.getConfiguration().addRole("auser", "arole");
ClientSessionFactory cf = createSessionFactory(locator);
ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
try {
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false);
Assert.fail("should throw exception");
} catch (ActiveMQSecurityException se) {
//ok
} catch (ActiveMQException e) {
fail("Invalid Exception type:" + e.getType());
}
session.close();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:SecurityTest.java
示例11: testDeleteTempQueueWithoutRole
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testDeleteTempQueueWithoutRole() throws Exception {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, false, false, true, false, false, false, false, false);
Set<Role> roles = new HashSet<>();
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.getConfiguration().addRole("auser", "arole");
ClientSessionFactory cf = createSessionFactory(locator);
ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false);
try {
session.deleteQueue(SecurityTest.queueA);
Assert.fail("should throw exception");
} catch (ActiveMQSecurityException se) {
//ok
} catch (ActiveMQException e) {
fail("Invalid Exception type:" + e.getType());
}
session.close();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:SecurityTest.java
示例12: testNonBlockSendWithoutRole
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testNonBlockSendWithoutRole() throws Exception {
ActiveMQServer server = createServer();
server.start();
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager();
securityManager.getConfiguration().addUser("auser", "pass");
Role role = new Role("arole", false, false, true, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>();
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.getConfiguration().addRole("auser", "arole");
ClientSessionFactory cf = createSessionFactory(locator);
ClientSession session = cf.createSession("auser", "pass", false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
ClientProducer cp = session.createProducer(SecurityTest.addressA);
cp.send(session.createMessage(false));
session.close();
Queue binding = (Queue) server.getPostOffice().getBinding(new SimpleString(SecurityTest.queueA)).getBindable();
Assert.assertEquals(0, getMessageCount(binding));
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:SecurityTest.java
示例13: testManifestEntries
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testManifestEntries() throws Exception {
Properties props = System.getProperties();
String userDir = props.getProperty("build.lib");
UnitTestLogger.LOGGER.trace("userDir is " + userDir);
// The jar must be there
File file = new File("build/jars", "activemq-core.jar");
Assert.assertTrue(file.exists());
// Open the jar and load MANIFEST.MF
JarFile jar = new JarFile(file);
Manifest manifest = jar.getManifest();
ActiveMQServer server = ActiveMQServers.newActiveMQServer(createBasicConfig());
ConnectionMetaData meta = new ActiveMQConnectionMetaData(server.getVersion());
// Compare the value from ConnectionMetaData and MANIFEST.MF
Attributes attrs = manifest.getMainAttributes();
Assert.assertEquals(meta.getProviderVersion(), attrs.getValue("ActiveMQ-Version"));
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:25,代码来源:ManifestTest.java
示例14: testAnycastMessageRoutingExclusivity
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testAnycastMessageRoutingExclusivity() throws Exception {
conn.connect(defUser, defPass);
final String addressA = "addressA";
final String queueA = "queueA";
final String queueB = "queueB";
final String queueC = "queueC";
ActiveMQServer activeMQServer = server.getActiveMQServer();
ActiveMQServerControl serverControl = server.getActiveMQServer().getActiveMQServerControl();
serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString());
serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString());
serverControl.createQueue(addressA, queueB, RoutingType.ANYCAST.toString());
serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString());
send(conn, addressA, null, "Hello World!", true, RoutingType.ANYCAST);
assertTrue(Wait.waitFor(() -> activeMQServer.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() + activeMQServer.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount() == 1, 2000, 100));
assertTrue(Wait.waitFor(() -> activeMQServer.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() == 0, 2000, 100));
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:StompTest.java
示例15: testAmbiguousMessageRouting
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testAmbiguousMessageRouting() throws Exception {
conn.connect(defUser, defPass);
final String addressA = "addressA";
final String queueA = "queueA";
final String queueB = "queueB";
final String queueC = "queueC";
final String queueD = "queueD";
ActiveMQServer activeMQServer = server.getActiveMQServer();
ActiveMQServerControl serverControl = server.getActiveMQServer().getActiveMQServerControl();
serverControl.createAddress(addressA, RoutingType.ANYCAST.toString() + "," + RoutingType.MULTICAST.toString());
serverControl.createQueue(addressA, queueA, RoutingType.ANYCAST.toString());
serverControl.createQueue(addressA, queueB, RoutingType.ANYCAST.toString());
serverControl.createQueue(addressA, queueC, RoutingType.MULTICAST.toString());
serverControl.createQueue(addressA, queueD, RoutingType.MULTICAST.toString());
send(conn, addressA, null, "Hello World!", true);
assertTrue(Wait.waitFor(() -> activeMQServer.locateQueue(SimpleString.toSimpleString(queueA)).getMessageCount() + activeMQServer.locateQueue(SimpleString.toSimpleString(queueB)).getMessageCount() == 1, 2000, 100));
assertTrue(Wait.waitFor(() -> activeMQServer.locateQueue(SimpleString.toSimpleString(queueC)).getMessageCount() + activeMQServer.locateQueue(SimpleString.toSimpleString(queueD)).getMessageCount() == 2, 2000, 100));
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:StompTest.java
示例16: configureAddressPolicy
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
protected void configureAddressPolicy(ActiveMQServer server) {
// Address configuration
AddressSettings addressSettings = new AddressSettings();
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
addressSettings.setAutoCreateQueues(isAutoCreateQueues());
addressSettings.setAutoCreateAddresses(isAutoCreateQueues());
addressSettings.setDeadLetterAddress(SimpleString.toSimpleString(getDeadLetterAddress()));
addressSettings.setExpiryAddress(SimpleString.toSimpleString(getDeadLetterAddress()));
server.getConfiguration().getAddressesSettings().put("#", addressSettings);
Set<TransportConfiguration> acceptors = server.getConfiguration().getAcceptorConfigurations();
for (TransportConfiguration tc : acceptors) {
if (tc.getName().equals("netty-acceptor")) {
tc.getExtraParams().put("anycastPrefix", "anycast://");
tc.getExtraParams().put("multicastPrefix", "multicast://");
}
}
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:AmqpClientTestSupport.java
示例17: createServer
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Override
protected ActiveMQServer createServer(final boolean realFiles,
final Configuration configuration,
final long pageSize,
final long maxAddressSize,
final Map<String, AddressSettings> settings) {
ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(configuration, realFiles));
if (settings != null) {
for (Map.Entry<String, AddressSettings> setting : settings.entrySet()) {
server.getAddressSettingsRepository().addMatch(setting.getKey(), setting.getValue());
}
}
server.getConfiguration().setGlobalMaxSize(maxAddressSize);
AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(pageSize).setMaxSizeBytes(-1).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
server.getAddressSettingsRepository().addMatch("#", defaultSetting);
return server;
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:GlobalPagingTest.java
示例18: testConsumeFromFormat
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
@Test
public void testConsumeFromFormat() throws Exception {
ActiveMQServer server = createServer(true);
DecodeJournal.importJournal(server.getConfiguration().getJournalLocation().getAbsolutePath(), "activemq-data", "amq", 2, 102400, new StringReader(journalFile));
DecodeJournal.importJournal(server.getConfiguration().getBindingsLocation().getAbsolutePath(), "activemq-bindings", "bindings", 2, 1048576, new StringReader(bindingsFile));
server.start();
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = factory.createSession();
session.start();
ClientConsumer consumer = session.createConsumer("A1");
for (int i = 0; i < 10; i++) {
ClientMessage msg = consumer.receive(5000);
assertNotNull(msg);
msg.acknowledge();
assertEquals(i, msg.getIntProperty("key").intValue());
}
session.commit();
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:ExportFormatTest.java
示例19: startServer
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
public static ActiveMQServer startServer() throws Exception {
if (server == null) {
Configuration config = new ConfigurationImpl().addAcceptorConfiguration("netty", "tcp://localhost:61616").setSecurityEnabled(false).addConnectorConfiguration("netty", "tcp://localhost:61616");
File dataPlace = new File("./target/dataJoram");
FileUtil.deleteDirectory(dataPlace);
config.setJournalDirectory(new File(dataPlace, "./journal").getAbsolutePath()).
setPagingDirectory(new File(dataPlace, "./paging").getAbsolutePath()).
setLargeMessagesDirectory(new File(dataPlace, "./largemessages").getAbsolutePath()).
setBindingsDirectory(new File(dataPlace, "./bindings").getAbsolutePath()).setPersistenceEnabled(true);
// disable server persistence since JORAM tests do not restart server
server = ActiveMQServers.newActiveMQServer(config, useFiles);
serverManager = new JMSServerManagerImpl(server);
serverManager.start();
}
return server;
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:SpawnedJMSServer.java
示例20: ActiveMQServerControlImpl
import org.apache.activemq.artemis.core.server.ActiveMQServer; //导入依赖的package包/类
public ActiveMQServerControlImpl(final PostOffice postOffice,
final Configuration configuration,
final ResourceManager resourceManager,
final RemotingService remotingService,
final ActiveMQServer messagingServer,
final MessageCounterManager messageCounterManager,
final StorageManager storageManager,
final NotificationBroadcasterSupport broadcaster) throws Exception {
super(ActiveMQServerControl.class, storageManager);
this.postOffice = postOffice;
this.configuration = configuration;
this.resourceManager = resourceManager;
this.remotingService = remotingService;
server = messagingServer;
this.messageCounterManager = messageCounterManager;
this.broadcaster = broadcaster;
server.getManagementService().addNotificationListener(this);
}
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:ActiveMQServerControlImpl.java
注:本文中的org.apache.activemq.artemis.core.server.ActiveMQServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论