@Override public ProtonConnectionImpl setProperties(final Map<Symbol, Object> properties) { LinkedHashMap<Symbol, Object> newProps = null; if (properties != null) { newProps = createInitialPropertiesMap(); newProps.putAll(properties); } connection.setProperties(newProps); return this; }
@Override public void onConnectionInit(Event event) { final Connection connection = event.getConnection(); final String hostName = new StringBuilder(messagingFactory.getHostName()) .append(":") .append(String.valueOf(this.getProtocolPort())) .toString(); TRACE_LOGGER.debug("onConnectionInit: hostname:{}", hostName); connection.setHostname(hostName); connection.setContainer(StringUtil.getShortRandomString()); final Map<Symbol, Object> connectionProperties = new HashMap<Symbol, Object>(); connectionProperties.put(AmqpConstants.PRODUCT, ClientConstants.PRODUCT_NAME); connectionProperties.put(AmqpConstants.VERSION, ClientConstants.CURRENT_JAVACLIENT_VERSION); connectionProperties.put(AmqpConstants.PLATFORM, ClientConstants.PLATFORM_INFO); connection.setProperties(connectionProperties); connection.open(); }
@Override public void onConnectionInit(Event event) { if (TRACE_LOGGER.isInfoEnabled()) { TRACE_LOGGER.info(String.format(Locale.US, "onConnectionInit hostname[%s]", this.amqpConnection.getHostName())); } final Connection connection = event.getConnection(); final String hostName = new StringBuilder(this.amqpConnection.getHostName()) .append(":") .append(String.valueOf(this.getProtocolPort())) .toString(); connection.setHostname(hostName); connection.setContainer(StringUtil.getRandomString()); final Map<Symbol, Object> connectionProperties = new HashMap<>(); connectionProperties.put(AmqpConstants.PRODUCT, ClientConstants.PRODUCT_NAME); connectionProperties.put(AmqpConstants.VERSION, ClientConstants.CURRENT_JAVACLIENT_VERSION); connectionProperties.put(AmqpConstants.PLATFORM, ClientConstants.PLATFORM_INFO); connectionProperties.put(AmqpConstants.FRAMEWORK, ClientConstants.FRAMEWORK_INFO); final String userAgent = EventHubClientImpl.USER_AGENT; if (userAgent != null) { connectionProperties.put(AmqpConstants.USER_AGENT, userAgent.length() < AmqpConstants.MAX_USER_AGENT_LENGTH ? userAgent : userAgent.substring(0, AmqpConstants.MAX_USER_AGENT_LENGTH)); } connection.setProperties(connectionProperties); connection.open(); }
ProtonConnectionImpl(Vertx vertx, String hostname, ContextInternal connCtx) { this.vertx = vertx; this.connCtx = connCtx; this.connection.setContext(this); this.connection.setContainer("vert.x-" + UUID.randomUUID()); this.connection.setHostname(hostname); Map<Symbol, Object> props = createInitialPropertiesMap(); connection.setProperties(props); }
public boolean validateConnection(org.apache.qpid.proton.engine.Connection connection, SASLResult saslResult) { remoteContainerId = connection.getRemoteContainer(); boolean idOK = server.addClientConnection(remoteContainerId, ExtCapability.needUniqueConnection(connection)); if (!idOK) { //https://issues.apache.org/jira/browse/ARTEMIS-728 Map<Symbol, Object> connProp = new HashMap<>(); connProp.put(AmqpSupport.CONNECTION_OPEN_FAILED, "true"); connection.setProperties(connProp); connection.getCondition().setCondition(AmqpError.INVALID_FIELD); Map<Symbol, Symbol> info = new HashMap<>(); info.put(AmqpSupport.INVALID_FIELD, AmqpSupport.CONTAINER_ID); connection.getCondition().setInfo(info); return false; } registeredConnectionId.set(true); return true; }
public boolean validateConnection(org.apache.qpid.proton.engine.Connection connection, SASLResult saslResult) { remoteContainerId = connection.getRemoteContainer(); boolean idOK = server.addClientConnection(remoteContainerId, ExtCapability.needUniqueConnection(connection)); if (!idOK) { //https://issues.apache.org/jira/browse/ARTEMIS-728 Map<Symbol, Object> connProp = new HashMap<>(); connProp.put(AmqpSupport.CONNECTION_OPEN_FAILED, "true"); connection.setProperties(connProp); connection.getCondition().setCondition(AmqpError.INVALID_FIELD); Map<Symbol, Symbol> info = new HashMap<>(); info.put(AmqpSupport.INVALID_FIELD, AmqpSupport.CONTAINER_ID); connection.getCondition().setInfo(info); return false; } registeredConnectionId.set(true); return true; }
public void open(String containerId, Map<Symbol, Object> connectionProperties) { this.transport.open(); this.connection.setContainer(containerId); this.connection.setProperties(connectionProperties); this.connection.open(); flush(); }
public void open(String containerId, Map<Symbol, Object> connectionProperties) { this.transport.open(); this.connection.setContainer(containerId); this.connection.setProperties(connectionProperties); this.connection.open(); flush(); }
@Override protected Connection createEndpoint(JmsConnectionInfo resourceInfo) { String hostname = getParent().getVhost(); if (hostname == null) { hostname = getParent().getRemoteURI().getHost(); } else if (hostname.isEmpty()) { hostname = null; } Map<Symbol, Object> props = new LinkedHashMap<Symbol, Object>(); props.put(AmqpSupport.PRODUCT, MetaDataSupport.PROVIDER_NAME); props.put(AmqpSupport.VERSION, MetaDataSupport.PROVIDER_VERSION); props.put(AmqpSupport.PLATFORM, MetaDataSupport.PLATFORM_DETAILS); Connection connection = getParent().getProtonConnection(); connection.setHostname(hostname); connection.setContainer(resourceInfo.getClientId()); connection.setDesiredCapabilities(new Symbol[] { SOLE_CONNECTION_CAPABILITY, DELAYED_DELIVERY, ANONYMOUS_RELAY, SHARED_SUBS}); connection.setProperties(props); return connection; }
@Override protected Connection createEndpoint(JmsConnectionInfo resourceInfo) { String hostname = getParent().getVhost(); if (hostname == null) { hostname = getParent().getRemoteURI().getHost(); } else if (hostname.isEmpty()) { hostname = null; } Map<Symbol, Object> props = new LinkedHashMap<Symbol, Object>(); props.put(AmqpSupport.PRODUCT, MetaDataSupport.PROVIDER_NAME); props.put(AmqpSupport.VERSION, MetaDataSupport.PROVIDER_VERSION); props.put(AmqpSupport.PLATFORM, MetaDataSupport.PLATFORM_DETAILS); Connection connection = getParent().getProtonConnection(); connection.setHostname(hostname); connection.setContainer(resourceInfo.getClientId()); connection.setDesiredCapabilities(new Symbol[] { SOLE_CONNECTION_CAPABILITY, DELAYED_DELIVERY, ANONYMOUS_RELAY, SHARED_SUBS}); connection.setProperties(props); return connection; }
@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 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); } } }
connection.setContext(AMQPConnectionContext.this); connection.setContainer(containerId); connection.setProperties(connectionProperties); connection.setOfferedCapabilities(getConnectionCapabilitiesOffered()); connection.open();
try { if (response.isException()) { protonConnection.setProperties(getFailedConnetionProperties()); protonConnection.open(); protonConnection.setProperties(getConnetionProperties()); protonConnection.setContainer(brokerService.getBrokerName()); protonConnection.open();
try { if (response.isException()) { protonConnection.setProperties(getFailedConnetionProperties()); protonConnection.open(); protonConnection.setProperties(getConnetionProperties()); protonConnection.setContainer(brokerService.getBrokerName()); protonConnection.open();
getEndpoint().setProperties(getOfferedProperties());
protonConnection.setProperties(getFailedConnetionProperties()); protonConnection.open(); protonConnection.setCondition(new ErrorCondition(AmqpError.PRECONDITION_FAILED, "Cannot send idle frames"));
protonConnection.setProperties(getFailedConnetionProperties()); protonConnection.open(); protonConnection.setCondition(new ErrorCondition(AmqpError.PRECONDITION_FAILED, "Cannot send idle frames"));