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); }
/** * 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); } }
remoteTransport = TransportFactory.connect(connectUri); } catch (Exception e) { LOG.warn("Could not connect to remote URI: {}: {}", connectUri, e.getMessage());
protected void handleStart() throws Exception { if (remoteTransport == null) { if (remoteURI == null) { throw new IllegalArgumentException("You must specify the remoteURI property"); } remoteTransport = TransportFactory.connect(remoteURI); } if (localTransport == null) { localTransport = createLocalTransport(); } bridge = createBridge(localTransport, remoteTransport); configureBridge(bridge); bridge.start(); // we need to start the transports after we've created the bridge remoteTransport.start(); localTransport.start(); super.handleStart(); }
protected Transport createLocalTransport() throws Exception { return TransportFactory.connect(localURI); }
/** * 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. * @author sepandm@gmail.com */ protected Transport createTransport() throws JMSException { try { return TransportFactory.connect(brokerURL, DEFAULT_CONNECTION_EXECUTOR); } catch (Exception e) { throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e); } }
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); }
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); }
/** * 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); } }
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); }
/** * 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); } }
/** * 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 void transportResumed() { try{ if(!firstConnection){ localBroker = TransportFactory.connect(localURI); localBroker.setTransportListener(new DefaultTransportListener() { public void onCommand(Object command) { } public void onException(IOException error) { if (started.get()) { serviceLocalException(error); } } }); localBroker.start(); restartBridge(); LOG.info("Slave connection between " + localBroker + " and " + remoteBroker + " has been reestablished."); }else{ firstConnection=false; } }catch(IOException e){ LOG.error("MasterConnector failed to send BrokerInfo in transportResumed:", e); }catch(Exception e){ LOG.error("MasterConnector failed to restart localBroker in transportResumed:", e); } } });
throw new IllegalArgumentException("You must specify a remoteURI"); localBroker = TransportFactory.connect(localURI); remoteBroker = TransportFactory.connect(remoteURI); LOG.info("Starting a slave connection between " + localBroker + " and " + remoteBroker); localBroker.setTransportListener(new DefaultTransportListener() {
remoteTransport = TransportFactory.connect(connectUri); } catch (Exception e) { LOG.warn("Could not connect to remote URI: {}: {}", connectUri, e.getMessage());
protected void handleStart() throws Exception { if (remoteTransport == null) { if (remoteURI == null) { throw new IllegalArgumentException("You must specify the remoteURI property"); } remoteTransport = TransportFactory.connect(remoteURI); } if (localTransport == null) { localTransport = createLocalTransport(); } bridge = createBridge(localTransport, remoteTransport); configureBridge(bridge); bridge.start(); // we need to start the transports after we've created the bridge remoteTransport.start(); localTransport.start(); super.handleStart(); }
protected void handleStart() throws Exception { if (remoteTransport == null) { if (remoteURI == null) { throw new IllegalArgumentException("You must specify the remoteURI property"); } remoteTransport = TransportFactory.connect(remoteURI); } if (localTransport == null) { localTransport = createLocalTransport(); } bridge = createBridge(localTransport, remoteTransport); configureBridge(bridge); bridge.start(); // we need to start the transports after we've created the bridge remoteTransport.start(); localTransport.start(); super.handleStart(); }
protected void handleStart() throws Exception { if (remoteTransport == null) { if (remoteURI == null) { throw new IllegalArgumentException("You must specify the remoteURI property"); } remoteTransport = TransportFactory.connect(remoteURI); } if (localTransport == null) { localTransport = createLocalTransport(); } bridge = createBridge(localTransport, remoteTransport); configureBridge(bridge); bridge.start(); // we need to start the transports after we've created the bridge remoteTransport.start(); localTransport.start(); super.handleStart(); }
protected void handleStart() throws Exception { if (remoteTransport == null) { if (remoteURI == null) { throw new IllegalArgumentException("You must specify the remoteURI property"); } remoteTransport = TransportFactory.connect(remoteURI); } if (localTransport == null) { localTransport = createLocalTransport(); } bridge = createBridge(localTransport, remoteTransport); configureBridge(bridge); bridge.start(); // we need to start the transports after we've created the bridge remoteTransport.start(); localTransport.start(); super.handleStart(); }
map.put("async", "false"); uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map)); Transport localTransport = TransportFactory.connect(uri); Transport remoteBridgeTransport = new ResponseCorrelator(transport); String duplexName = localTransport.toString();