/** * Creates a normal transport. * * @param location * @return the transport * @throws Exception */ public static Transport connect(URI location) throws Exception { TransportFactory tf = findTransportFactory(location); return tf.doConnect(location); }
public Transport doCompositeConnect(URI location) throws Exception { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); WireFormat wf = createWireFormat(options); Transport transport = createTransport(location, wf); Transport rc = compositeConfigure(transport, wf, options); if (!options.isEmpty()) { throw new IllegalArgumentException("Invalid connect parameters: " + options); } return rc; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
private Transport createRemoteTransport(final Transport local) throws Exception { Transport transport = TransportFactory.compositeConnect(remote); CompositeTransport ct = transport.narrow(CompositeTransport.class); if (ct != null && localUri != null && proxyToLocalBroker) { ct.add(false, new URI[] { localUri }); } // Add a transport filter so that we can track the transport life cycle transport = new TransportFilter(transport) { @Override public void stop() throws Exception { LOG.info("Stopping proxy."); super.stop(); ProxyConnection dummy = new ProxyConnection(local, this); LOG.debug("Removing proxyConnection {}", dummy.toString()); connections.remove(dummy); } }; return transport; }
/** * Creates a slimmed down transport that is more efficient so that it can be * used by composite transports like reliable and HA. * * @param location * @return the Transport * @throws Exception */ public static Transport compositeConnect(URI location) throws Exception { TransportFactory tf = findTransportFactory(location); return tf.doCompositeConnect(location); }
public static TransportServer bind(URI location) throws IOException { TransportFactory tf = findTransportFactory(location); return tf.doBind(location); }
public Transport doConnect(URI location) throws Exception { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); if( !options.containsKey("wireFormat.host") ) { options.put("wireFormat.host", location.getHost()); } WireFormat wf = createWireFormat(options); Transport transport = createTransport(location, wf); Transport rc = configure(transport, wf, options); //remove auto IntrospectionSupport.extractProperties(options, "auto."); if (!options.isEmpty()) { throw new IllegalArgumentException("Invalid connect parameters: " + options); } return rc; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
/** * Fully configures and adds all need transport filters so that the * transport can be used by the ActiveMQ message broker. The main difference * between this and the configure() method is that the broker does not issue * requests to the client so the ResponseCorrelator is not needed. * * @param transport * @param format * @param options * @return * @throws Exception */ @SuppressWarnings("rawtypes") public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { if (options.containsKey(THREAD_NAME_FILTER)) { transport = new ThreadNameFilter(transport); } transport = compositeConfigure(transport, format, options); transport = new MutexTransport(transport); return transport; }
private static Transport createLocalTransport(URI uri, boolean async) throws Exception { HashMap<String, String> map = new HashMap<String, String>(URISupport.parseParameters(uri)); map.put("async", String.valueOf(async)); map.put("create", "false"); // we don't want a vm connect during shutdown to trigger a broker create uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map)); return TransportFactory.connect(uri); }
public Transport doConnect(URI location, Executor ex) throws Exception { return doConnect(location); }
protected TransportServer createServer() throws IOException, URISyntaxException { if (bind == null) { throw new IllegalArgumentException("You must specify either a server or the bind property"); } return TransportFactory.bind(bind); }
public static TransportServer bind(BrokerService brokerService, URI location) throws IOException { TransportFactory tf = TransportFactory.findTransportFactory(location); if( brokerService!=null && tf instanceof BrokerServiceAware) { ((BrokerServiceAware)tf).setBrokerService(brokerService); } try { if( brokerService!=null ) { SslContext.setCurrentSslContext(brokerService.getSslContext()); } return tf.doBind(location); } finally { SslContext.setCurrentSslContext(null); } }
/** * Creates a slimmed down transport that is more efficient so that it can be * used by composite transports like reliable and HA. * * @param location * @param ex * @return the Transport * @throws Exception */ public static Transport compositeConnect(URI location, Executor ex) throws Exception { TransportFactory tf = findTransportFactory(location); return tf.doCompositeConnect(location, ex); }
public Transport doConnect(URI location) throws Exception { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); WireFormat wf = createWireFormat(options); Transport transport = createTransport(location, wf); Transport rc = configure(transport, wf, options); if (!options.isEmpty()) { throw new IllegalArgumentException("Invalid connect parameters: " + options); } return rc; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
/** * Fully configures and adds all need transport filters so that the * transport can be used by the JMS client. * * @param transport * @param wf * @param options * @return * @throws Exception */ @SuppressWarnings("rawtypes") public Transport configure(Transport transport, WireFormat wf, Map options) throws Exception { transport = compositeConfigure(transport, wf, options); transport = new MutexTransport(transport); transport = new ResponseCorrelator(transport); return transport; }
/** * Creates a Transport based on this object's connection settings. Separated * from createActiveMQConnection to allow for subclasses to override. * * @return The newly created Transport. * @throws JMSException If unable to create trasnport. */ protected Transport createTransport() throws JMSException { try { URI connectBrokerUL = brokerURL; String scheme = brokerURL.getScheme(); if (scheme == null) { throw new IOException("Transport not scheme specified: [" + brokerURL + "]"); } if (scheme.equals("auto")) { connectBrokerUL = new URI(brokerURL.toString().replace("auto", "tcp")); } else if (scheme.equals("auto+ssl")) { connectBrokerUL = new URI(brokerURL.toString().replace("auto+ssl", "ssl")); } else if (scheme.equals("auto+nio")) { connectBrokerUL = new URI(brokerURL.toString().replace("auto+nio", "nio")); } else if (scheme.equals("auto+nio+ssl")) { connectBrokerUL = new URI(brokerURL.toString().replace("auto+nio+ssl", "nio+ssl")); } return TransportFactory.connect(connectBrokerUL); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } }
public Transport doConnect(URI location, Executor ex) throws Exception { return doConnect(location); }
/** * @deprecated */ public static TransportServer bind(String brokerId, URI location) throws IOException { return bind(location); }
/** * Creates a normal transport. * * @param location * @param ex * @return the transport * @throws Exception */ public static Transport connect(URI location, Executor ex) throws Exception { TransportFactory tf = findTransportFactory(location); return tf.doConnect(location, ex); }
public static TransportServer bind(URI location) throws IOException { TransportFactory tf = findTransportFactory(location); return tf.doBind(location); }
public Transport doCompositeConnect(URI location) throws Exception { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); WireFormat wf = createWireFormat(options); Transport transport = createTransport(location, wf); Transport rc = compositeConfigure(transport, wf, options); if (!options.isEmpty()) { throw new IllegalArgumentException("Invalid connect parameters: " + options); } return rc; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }