Search in sources :

Example 1 with TransportConfiguration

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;
}
Also used : NettyConnectorFactory(org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration)

Example 2 with TransportConfiguration

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;
}
Also used : TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) InVMConnectorFactory(org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory)

Example 3 with TransportConfiguration

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;
}
Also used : HashMap(java.util.HashMap) Resource(org.jboss.as.controller.registry.Resource) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) InVMConnectorFactory(org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory) ModelNode(org.jboss.dmr.ModelNode)

Example 4 with 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();
}
Also used : ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) Before(org.junit.Before)

Example 5 with TransportConfiguration

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);
}
Also used : JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) JMSConfiguration(org.apache.activemq.artemis.jms.server.config.JMSConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) ConnectionFactoryConfiguration(org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration) JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) JMSConfiguration(org.apache.activemq.artemis.jms.server.config.JMSConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ConnectionFactoryConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) JMSQueueConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) ConnectionFactoryConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl) JMSQueueConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl) ConnectionFactoryConfiguration(org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration)

Aggregations

TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)16 HashMap (java.util.HashMap)9 NettyConnectorFactory (org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory)5 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)3 InVMConnectorFactory (org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory)3 ModelNode (org.jboss.dmr.ModelNode)3 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)2 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)2 ConfigurationImpl (org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)2 Property (org.jboss.dmr.Property)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InetSocketAddress (java.net.InetSocketAddress)1 DataSource (javax.sql.DataSource)1 BroadcastEndpointFactory (org.apache.activemq.artemis.api.core.BroadcastEndpointFactory)1 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)1 ChannelBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory)1