Package org.apache.activemq.transport

Examples of org.apache.activemq.transport.Transport


    public void start() throws Exception {

        this.getServer().setAcceptListener(new TransportAcceptListener() {
            public void onAccept(Transport localTransport) {
                try {
                    Transport remoteTransport = createRemoteTransport();
                    ProxyConnection connection = new ProxyConnection(localTransport, remoteTransport);
                    connections.add(connection);
                    connection.start();
                } catch (Exception e) {
                    onAcceptError(e);
View Full Code Here


        }
        return TransportFactory.bind(null, bind);
    }

    private Transport createRemoteTransport() throws Exception {
        Transport transport = TransportFactory.compositeConnect(remote);
        CompositeTransport ct = (CompositeTransport)transport.narrow(CompositeTransport.class);
        if (ct != null && localUri != null) {
            ct.add(new URI[] {localUri});
        }

        // Add a transport filter so that can track the transport life cycle
View Full Code Here

            if (bridges.containsKey(uri) || localURI.equals(uri) || (connectionFilter != null && !connectionFilter.connectTo(uri))) {
                return;
            }
            URI connectUri = uri;
            LOG.info("Establishing network connection between from " + localURIName + " to " + connectUri);
            Transport remoteTransport;
            try {
                remoteTransport = TransportFactory.connect(connectUri);
            } catch (Exception e) {
                LOG.warn("Could not connect to remote URI: " + localURIName + ": " + e.getMessage());
                LOG.debug("Connection failure exception: " + e, e);
                return;
            }
            Transport localTransport;
            try {
                localTransport = createLocalTransport();
            } catch (Exception e) {
                ServiceSupport.dispose(remoteTransport);
                LOG.warn("Could not connect to local URI: " + localURIName + ": " + e.getMessage());
View Full Code Here

            WireFormat wf = createWireFormat(options);
            int port = location.getPort();
            OpenWireFormat openWireFormat = asOpenWireFormat(wf);
            UdpTransport transport = new UdpTransport(openWireFormat, port);

            Transport configuredTransport = configure(transport, wf, options, true);
            UdpTransportServer server = new UdpTransportServer(location, transport, configuredTransport, createReplayStrategy());
            return server;
        } catch (URISyntaxException e) {
            throw IOExceptionSupport.create(e);
        } catch (Exception e) {
View Full Code Here

                            Iterator<Object> iter = connectList.iterator();
                            for (int i = 0; iter.hasNext() && connectedTransport == null && !disposed; i++) {
                                URI uri = (URI)iter.next();
                                try {
                                    LOG.debug("Attempting connect to: " + uri);
                                    Transport t = TransportFactory.compositeConnect(uri);
                                    t.setTransportListener(myTransportListener);
                                    t.start();

                                    if (started) {
                                        restoreTransport(t);
                                    }
View Full Code Here

            }
        }
    }

    public void stop() throws Exception {
        Transport transportToStop=null;
        synchronized (reconnectMutex) {
            LOG.debug("Stopped.");
            if (!started) {
                return;
            }
            started = false;
            disposed = true;

            if (connectedTransport != null) {
                transportToStop = connectedTransport;
                connectedTransport = null;
            }
            reconnectMutex.notifyAll();
        }
        synchronized (sleepMutex) {
            sleepMutex.notifyAll();
        }
        reconnectTask.shutdown();
        if( transportToStop!=null ) {
            transportToStop.stop();
        }
    }
View Full Code Here

            }
        }

        VMTransport vmtransport = server.connect();
        IntrospectionSupport.setProperties(vmtransport, options);
        Transport transport = vmtransport;
        if (vmtransport.isMarshal()) {
            Map<String, String> optionsCopy = new HashMap<String, String>(options);
            transport = new MarshallingTransportFilter(transport, createWireFormat(options),
                                                       createWireFormat(optionsCopy));
        }
View Full Code Here

public class FanoutTransportFactory extends TransportFactory {

    public Transport doConnect(URI location) throws IOException {
        try {
            Transport transport = createTransport(location);
            transport = new MutexTransport(transport);
            transport = new ResponseCorrelator(transport);
            return transport;
        } catch (URISyntaxException e) {
            throw new IOException("Invalid location: " + location);
View Full Code Here

                URI uri = broker.getVmConnectorURI();
                HashMap<String, String> map = new HashMap<String, String>(URISupport.parseParamters(uri));
                map.put("network", "true");
                map.put("async", "false");
                uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map));
                Transport localTransport = TransportFactory.connect(uri);
                Transport remoteBridgeTransport = new ResponseCorrelator(transport);
                duplexBridge = NetworkBridgeFactory.createBridge(config, localTransport,
                                                                 remoteBridgeTransport);
                // now turn duplex off this side
                info.setDuplexConnection(false);
                duplexBridge.setCreatedByDuplex(true);
View Full Code Here

        if (brokerURL == null) {
            throw new ConfigurationException("brokerURL not set.");
        }
        ActiveMQConnection connection = null;
        try {
            Transport transport = createTransport();
            connection = createActiveMQConnection(transport, factoryStats);

            connection.setUserName(userName);
            connection.setPassword(password);

            configureConnection(connection);

            transport.start();

            if (clientID != null) {
                connection.setDefaultClientID(clientID);
            }
View Full Code Here

TOP

Related Classes of org.apache.activemq.transport.Transport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.