use of org.apache.activemq.artemis.api.core.client.ServerLocator in project spring-boot by spring-projects.
the class ArtemisConnectionFactoryFactory method createEmbeddedConnectionFactory.
private <T extends ActiveMQConnectionFactory> T createEmbeddedConnectionFactory(Class<T> factoryClass) throws Exception {
try {
TransportConfiguration transportConfiguration = new TransportConfiguration(InVMConnectorFactory.class.getName(), this.properties.getEmbedded().generateTransportParameters());
ServerLocator serviceLocator = ActiveMQClient.createServerLocatorWithoutHA(transportConfiguration);
return factoryClass.getConstructor(ServerLocator.class).newInstance(serviceLocator);
} catch (NoClassDefFoundError ex) {
throw new IllegalStateException("Unable to create InVM " + "Artemis connection, ensure that artemis-jms-server.jar " + "is in the classpath", ex);
}
}
use of org.apache.activemq.artemis.api.core.client.ServerLocator in project wildfly by wildfly.
the class CoreQueueManagementTestCase method setup.
@Before
public void setup() throws Exception {
count++;
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("host", TestSuiteEnvironment.getServerAddress());
map.put("port", 8080);
map.put(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, true);
map.put(TransportConstants.HTTP_UPGRADE_ENDPOINT_PROP_NAME, "http-acceptor");
TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), map);
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(transportConfiguration);
locator.setBlockOnDurableSend(true);
locator.setBlockOnNonDurableSend(true);
sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession("guest", "guest", false, true, true, false, 1);
session.createQueue(getQueueName(), getQueueName(), false);
session.createQueue(getOtherQueueName(), getOtherQueueName(), false);
consumerSession = sessionFactory.createSession("guest", "guest", false, false, false, false, 1);
}
use of org.apache.activemq.artemis.api.core.client.ServerLocator in project wildfly by wildfly.
the class ImportJournalOperation method executeRuntimeStep.
@Override
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
if (context.getRunningMode() != NORMAL) {
throw MessagingLogger.ROOT_LOGGER.managementOperationAllowedOnlyInRunningMode("import-journal", NORMAL);
}
String file = FILE.resolveModelAttribute(context, operation).asString();
final XmlDataImporter importer = new XmlDataImporter();
TransportConfiguration transportConfiguration = createInVMTransportConfiguration(context);
try (InputStream is = new FileInputStream(new File(file));
ServerLocator serverLocator = ActiveMQClient.createServerLocator(false, transportConfiguration);
ClientSessionFactory sf = serverLocator.createSessionFactory()) {
ClientSession session = sf.createSession();
importer.process(is, session);
} catch (Exception e) {
throw new OperationFailedException(e);
}
}
Aggregations