use of org.apache.activemq.artemis.api.core.client.ClientSession in project wildfly by wildfly.
the class ArtemisMessagingTestCase method stop.
@After
public void stop() throws Exception {
if (session != null) {
session.close();
}
if (sf != null) {
ClientSession coreSession = sf.createSession();
coreSession.deleteQueue(QUEUE_EXAMPLE_QUEUE);
coreSession.close();
sf.close();
}
}
use of org.apache.activemq.artemis.api.core.client.ClientSession 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