@Override public Map<Symbol, Object> getRemoteProperties() { return connection.getRemoteProperties(); }
@Override public void inspectOpenedResource(Connection connection) { if (!connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) { markAsInvalid("Broker did not set connection establishment failed property"); } }
private void getUserAndRolesFromConnection(Connection connection) { final Map<Symbol, Object> remoteProperties = connection.getRemoteProperties(); Symbol[] supportedCapabilities = connection.getRemoteOfferedCapabilities(); boolean supportsAuthz = supportedCapabilities != null && Arrays.asList(supportedCapabilities).contains(CAPABILITY_ADDRESS_AUTHZ);
@Override protected void doOpenCompletion() { if (getEndpoint().getRemoteProperties() == null || !getEndpoint().getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) {
@Override public void onRemoteOpen(Connection connection) throws Exception { synchronized (getLock()) { connection.setContext(AbstractConnectionContext.this); connection.setContainer(containerId); connection.setProperties(connectionProperties); connection.open(); } initialise(); /* * This can be null which is in effect an empty map, also we really dont need to check this for in bound connections * but its here in case we add support for outbound connections. * */ if (connection.getRemoteProperties() == null || !connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) { long nextKeepAliveTime = handler.tick(true); flushBytes(); if (nextKeepAliveTime > 0 && scheduledPool != null) { scheduledPool.schedule(new Runnable() { @Override public void run() { long rescheduleAt = (handler.tick(false) - TimeUnit.NANOSECONDS.toMillis(System.nanoTime())); flushBytes(); if (rescheduleAt > 0) { scheduledPool.schedule(this, rescheduleAt, TimeUnit.MILLISECONDS); } } }, (nextKeepAliveTime - TimeUnit.NANOSECONDS.toMillis(System.nanoTime())), TimeUnit.MILLISECONDS); } } }
@Override protected void afterOpened() { // Initialize the connection properties so that the state of the remote can // be determined, this allows us to check for close pending. getResource().getProperties().initialize( getEndpoint().getRemoteOfferedCapabilities(), getEndpoint().getRemoteProperties()); // If there are failover servers in the open then we signal that to the listeners List<AmqpRedirect> failoverList = getResource().getProperties().getFailoverServerList(); if (!failoverList.isEmpty()) { List<URI> failoverURIs = new ArrayList<>(); for (AmqpRedirect redirect : failoverList) { try { failoverURIs.add(redirect.toURI()); } catch (Exception ex) { LOG.trace("Error while creating URI from failover server: {}", redirect); } } } }
@Override public void onRemoteOpen(Connection connection) throws Exception { handler.requireHandler(); try { initInternal(); } catch (Exception e) { log.error("Error init connection", e); } if (!validateConnection(connection)) { connection.close(); } else { connection.setContext(AMQPConnectionContext.this); connection.setContainer(containerId); connection.setProperties(connectionProperties); connection.setOfferedCapabilities(getConnectionCapabilitiesOffered()); connection.open(); } initialise(); /* * This can be null which is in effect an empty map, also we really don't need to check this for in bound connections * but its here in case we add support for outbound connections. * */ if (connection.getRemoteProperties() == null || !connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) { long nextKeepAliveTime = handler.tick(true); if (nextKeepAliveTime != 0 && scheduledPool != null) { scheduledPool.schedule(new ScheduleRunnable(), (nextKeepAliveTime - TimeUnit.NANOSECONDS.toMillis(System.nanoTime())), TimeUnit.MILLISECONDS); } } }
@Override protected void afterOpened() { // Initialize the connection properties so that the state of the remote can // be determined, this allows us to check for close pending. getResource().getProperties().initialize( getEndpoint().getRemoteOfferedCapabilities(), getEndpoint().getRemoteProperties()); // If there are failover servers in the open then we signal that to the listeners List<AmqpRedirect> failoverList = getResource().getProperties().getFailoverServerList(); if (!failoverList.isEmpty()) { List<URI> failoverURIs = new ArrayList<>(); for (AmqpRedirect redirect : failoverList) { try { failoverURIs.add(redirect.toURI()); } catch (Exception ex) { LOG.trace("Error while creating URI from failover server: {}", redirect); } } } }
if (connection.getRemoteProperties() == null || !connection.getRemoteProperties().containsKey(CONNECTION_OPEN_FAILED)) { long nextKeepAliveTime = handler.tick(true); if (nextKeepAliveTime != 0 && scheduledPool != null) {
@Override public void inspectOpenedResource(Connection connection) { Map<Symbol, Object> properties = connection.getRemoteProperties(); if (!properties.containsKey(PRODUCT)) { markAsInvalid("Broker did not send a queue product name value"); return; } if (!properties.containsKey(VERSION)) { markAsInvalid("Broker did not send a queue version value"); return; } if (!PRODUCT_NAME.equals(properties.get(PRODUCT))) { markAsInvalid("Broker did not send a the expected product name"); return; } String brokerVersion = VersionLoader.getVersion().getFullVersion(); if (!brokerVersion.equals(properties.get(VERSION))) { markAsInvalid("Broker did not send a the expected product version"); return; } } });