Search in sources :

Example 56 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();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Using amqp port: " + port);
    }
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector)

Example 57 with TransportConnector

use of org.apache.activemq.broker.TransportConnector in project vcell by virtualcell.

the class ActiveMqTest method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        BrokerService broker = new BrokerService();
        broker.setBrokerName("fred");
        broker.setUseShutdownHook(false);
        broker.setPersistent(false);
        // Add plugin
        // broker.setPlugins(new BrokerPlugin[]{new JaasAuthenticationPlugin()});
        // Add a network connection
        NetworkConnector connector = broker.addNetworkConnector("static://" + "tcp://localhost:61616");
        connector.setDuplex(true);
        TransportConnector transportConnector = broker.addConnector("tcp://localhost:61616");
        broker.start();
        // transportConnector.
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) TransportConnector(org.apache.activemq.broker.TransportConnector) NetworkConnector(org.apache.activemq.network.NetworkConnector) BrokerService(org.apache.activemq.broker.BrokerService)

Example 58 with TransportConnector

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

the class StompBrokerRelayMessageHandlerIntegrationTests method startActiveMQBroker.

private void startActiveMQBroker() throws Exception {
    TransportConnector stompConnector = createStompConnector(this.port);
    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();
    // Reuse existing ephemeral port on restart (i.e., the next time this method
    // is invoked) since it will already be configured in the relay
    this.port = (this.port != 0 ? this.port : stompConnector.getServer().getSocketAddress().getPort());
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) BrokerService(org.apache.activemq.broker.BrokerService)

Example 59 with TransportConnector

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

the class StompBrokerRelayMessageHandlerIntegrationTests method createStompConnector.

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

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