Search in sources :

Example 26 with TransportConnector

use of org.apache.activemq.broker.TransportConnector in project activemq-artemis by apache.

the class MulticastDiscoveryOnFaultyNetworkTest method bridgeBrokers.

@Override
protected NetworkConnector bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker, boolean dynamicOnly, int networkTTL, boolean conduit, boolean failover) throws Exception {
    String networkDisoveryUrlString = useStaticDiscovery ? "static:(" + remoteBroker.getTransportConnectors().get(0).getPublishableConnectString() + ")?useExponentialBackOff=false" : "multicast://default?group=TESTERIC&useLocalHost=false";
    DiscoveryNetworkConnector connector = new DiscoveryNetworkConnector(new URI(networkDisoveryUrlString));
    connector.setDynamicOnly(dynamicOnly);
    connector.setNetworkTTL(networkTTL);
    connector.setDuplex(useDuplexNetworkBridge);
    maxSetupTime = 2000;
    if (!useStaticDiscovery) {
        List<TransportConnector> transportConnectors = remoteBroker.getTransportConnectors();
        if (!transportConnectors.isEmpty()) {
            TransportConnector mCastTrpConnector = (transportConnectors.get(0));
            mCastTrpConnector.setDiscoveryUri(new URI("multicast://default?group=TESTERIC"));
        }
    }
    localBroker.addNetworkConnector(connector);
    return connector;
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) DiscoveryNetworkConnector(org.apache.activemq.network.DiscoveryNetworkConnector) URI(java.net.URI)

Example 27 with TransportConnector

use of org.apache.activemq.broker.TransportConnector in project activemq-artemis by apache.

the class ConsumeUncompressedCompressedMessageTest method createBroker.

protected BrokerService createBroker(boolean delete) throws Exception {
    BrokerService answer = new BrokerService();
    answer.setPersistent(false);
    answer.setDeleteAllMessagesOnStartup(true);
    answer.setSchedulerSupport(false);
    answer.setUseJmx(true);
    TransportConnector connector = answer.addConnector("tcp://localhost:0");
    tcpUri = connector.getConnectUri();
    return answer;
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) BrokerService(org.apache.activemq.broker.BrokerService)

Example 28 with TransportConnector

use of org.apache.activemq.broker.TransportConnector in project spring-framework by spring-projects.

the class ReactorNettyTcpStompClientTests method createStompConnector.

private TransportConnector createStompConnector() throws Exception {
    TransportConnector connector = new TransportConnector();
    connector.setUri(new URI("stomp://127.0.0.1:0"));
    return connector;
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) URI(java.net.URI)

Example 29 with TransportConnector

use of org.apache.activemq.broker.TransportConnector in project spring-framework by spring-projects.

the class ReactorNettyTcpStompClientTests method setup.

@BeforeEach
public void setup(TestInfo testInfo) throws Exception {
    logger.debug("Setting up before '" + testInfo.getTestMethod().get().getName() + "'");
    TransportConnector stompConnector = createStompConnector();
    this.activeMQBroker = new BrokerService();
    this.activeMQBroker.addConnector(stompConnector);
    this.activeMQBroker.setStartAsync(false);
    this.activeMQBroker.setPersistent(false);
    this.activeMQBroker.setUseJmx(false);
    this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5);
    this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5);
    this.activeMQBroker.start();
    ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
    taskScheduler.afterPropertiesSet();
    this.client = new ReactorNettyTcpStompClient("127.0.0.1", stompConnector.getServer().getSocketAddress().getPort());
    this.client.setMessageConverter(new StringMessageConverter());
    this.client.setTaskScheduler(taskScheduler);
}
Also used : StringMessageConverter(org.springframework.messaging.converter.StringMessageConverter) TransportConnector(org.apache.activemq.broker.TransportConnector) BrokerService(org.apache.activemq.broker.BrokerService) ThreadPoolTaskScheduler(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 30 with TransportConnector

use of org.apache.activemq.broker.TransportConnector in project vertx-proton by vert-x3.

the class ActiveMQTestBase method addAdditionalConnectors.

// Subclasses can override to add/restrict to their own connectors.
protected void addAdditionalConnectors(BrokerService brokerService, Map<String, Integer> portMap) throws Exception {
    int port = PORT;
    if (portMap.containsKey(AMQP_CONNECTOR_NAME)) {
        port = portMap.get(AMQP_CONNECTOR_NAME);
    }
    TransportConnector connector = brokerService.addConnector("amqp://0.0.0.0:" + port + "?transport.transformer=" + getAmqpTransformer() + "&transport.socketBufferSize=" + getSocketBufferSize() + "&ioBufferSize=" + getIOBufferSize());
    connector.setName(AMQP_CONNECTOR_NAME);
    port = connector.getPublishableConnectURI().getPort();
    LOG.debug("Using amqp port: {}", port);
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector)

Aggregations

TransportConnector (org.apache.activemq.broker.TransportConnector)59 URI (java.net.URI)31 BrokerService (org.apache.activemq.broker.BrokerService)31 NetworkConnector (org.apache.activemq.network.NetworkConnector)10 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)9 DiscoveryNetworkConnector (org.apache.activemq.network.DiscoveryNetworkConnector)7 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Connection (javax.jms.Connection)4 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)4 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)4 JMSException (javax.jms.JMSException)3 Session (javax.jms.Session)3 File (java.io.File)2 Principal (java.security.Principal)2 MessageProducer (javax.jms.MessageProducer)2 ActiveMQMessageConsumer (org.apache.activemq.ActiveMQMessageConsumer)2 ConnectionContext (org.apache.activemq.broker.ConnectionContext)2 Connector (org.apache.activemq.broker.Connector)2 StubConnection (org.apache.activemq.broker.StubConnection)2