use of org.apache.activemq.artemis.api.core.TransportConfiguration in project spring-boot by spring-projects.
the class ArtemisAutoConfigurationTests method assertNettyConnectionFactory.
private TransportConfiguration assertNettyConnectionFactory(ActiveMQConnectionFactory connectionFactory, String host, int port) {
TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory);
assertThat(transportConfig.getFactoryClassName()).isEqualTo(NettyConnectorFactory.class.getName());
assertThat(transportConfig.getParams().get("host")).isEqualTo(host);
assertThat(transportConfig.getParams().get("port")).isEqualTo(port);
return transportConfig;
}
use of org.apache.activemq.artemis.api.core.TransportConfiguration in project spring-boot by spring-projects.
the class ArtemisAutoConfigurationTests method assertInVmConnectionFactory.
private TransportConfiguration assertInVmConnectionFactory(ActiveMQConnectionFactory connectionFactory) {
TransportConfiguration transportConfig = getSingleTransportConfiguration(connectionFactory);
assertThat(transportConfig.getFactoryClassName()).isEqualTo(InVMConnectorFactory.class.getName());
return transportConfig;
}
use of org.apache.activemq.artemis.api.core.TransportConfiguration in project wildfly by wildfly.
the class ImportJournalOperation method createInVMTransportConfiguration.
/**
* The XmlDataImporter requires a connector to connect to the artemis broker.
*
* We require to use a in-vm one so that importing a journal is not subject to any network connection problem.
*/
private TransportConfiguration createInVMTransportConfiguration(OperationContext context) throws OperationFailedException {
final Resource serverResource = context.readResource(EMPTY_ADDRESS, false);
Set<Resource.ResourceEntry> invmConnectors = serverResource.getChildren(CommonAttributes.IN_VM_CONNECTOR);
if (invmConnectors.isEmpty()) {
throw MessagingLogger.ROOT_LOGGER.noInVMConnector();
}
Resource.ResourceEntry connectorEntry = invmConnectors.iterator().next();
Resource connectorResource = context.readResource(PathAddress.pathAddress(connectorEntry.getPathElement()), false);
ModelNode model = connectorResource.getModel();
Map<String, Object> params = new HashMap<>(CommonAttributes.PARAMS.unwrap(context, model));
params.put(InVMTransportDefinition.SERVER_ID.getName(), InVMTransportDefinition.SERVER_ID.resolveModelAttribute(context, model).asInt());
TransportConfiguration transportConfiguration = new TransportConfiguration(InVMConnectorFactory.class.getName(), params);
return transportConfiguration;
}
use of org.apache.activemq.artemis.api.core.TransportConfiguration in project wildfly by wildfly.
the class ArtemisMessagingTestCase method start.
@Before
public void start() throws Exception {
//Not using JNDI so we use the core services directly
sf = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName())).createSessionFactory();
session = sf.createSession();
//Create a queue
ClientSession coreSession = sf.createSession();
coreSession.createQueue(QUEUE_EXAMPLE_QUEUE, QUEUE_EXAMPLE_QUEUE, false);
coreSession.close();
session = sf.createSession();
session.start();
}
use of org.apache.activemq.artemis.api.core.TransportConfiguration in project camel by apache.
the class Jms2TestSupport method configureBroker.
protected void configureBroker(EmbeddedJMS broker) throws Exception {
Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setJournalDirectory("target/data/journal").setSecurityEnabled(false).addAcceptorConfiguration("connector", brokerUri + "?protocols=CORE,AMQP,HORNETQ,OPENWIRE").addAcceptorConfiguration("vm", "vm://broker").addConnectorConfiguration("connector", new TransportConfiguration(NettyConnectorFactory.class.getName()));
JMSConfiguration jmsConfig = new JMSConfigurationImpl();
ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(Arrays.asList("connector")).setBindings("cf");
jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1");
jmsConfig.getQueueConfigurations().add(queueConfig);
broker.setConfiguration(configuration).setJmsConfiguration(jmsConfig);
}
Aggregations