@Override public ProtonConnectionImpl setHostname(String hostname) { connection.setHostname(hostname); 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); }
@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; }
private void performConnectionOpen(Connection connection, InputStream in, OutputStream out) throws IOException, LoginException { connection.setHostname(saslHostname); connection.setContainer(container); connection.setDesiredCapabilities(new Symbol[] {CAPABILITY_ADDRESS_AUTHZ}); connection.open(); writeToNetwork(connection, out); readFromNetwork(connection, in, () -> connection.getRemoteState() == EndpointState.UNINITIALIZED); }
@Override public void onConnectionInit(Event event) { // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_011: [The event handler shall set the host name on the connection] Connection conn = event.getConnection(); conn.setHostname(hostName); // Every session or link could have their own handler(s) if we // wanted simply by adding the handler to the given session // or link // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_012: [The event handler shall create a Session (Proton) object from the connection] Session ssn = conn.session(); // If a link doesn't have an event handler, the events go to // its parent session. If the session doesn't have a handler // the events go to its parent connection. If the connection // doesn't have a handler, the events go to the reactor. // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_013: [The event handler shall create a Receiver (Proton) object and set the protocol tag on it to a predefined constant] // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_15_017: [The Receiver object shall have the properties set to service client version identifier.] Map<Symbol, Object> properties = new HashMap<>(); properties.put(Symbol.getSymbol(TransportUtils.versionIdentifierKey), TransportUtils.USER_AGENT_STRING); Receiver receiver = ssn.receiver(RECEIVE_TAG); receiver.setProperties(properties); // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_014: [The event handler shall open the Connection, the Session and the Receiver object] conn.open(); ssn.open(); receiver.open(); }
@Override public void onConnectionInit(Event event) { // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_011: [The event handler shall set the host name on the connection] Connection conn = event.getConnection(); conn.setHostname(hostName); // Every session or link could have their own handler(s) if we // wanted simply by adding the handler to the given session // or link // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_012: [The event handler shall create a Session (Proton) object from the connection] Session ssn = conn.session(); // If a link doesn't have an event handler, the events go to // its parent session. If the session doesn't have a handler // the events go to its parent connection. If the connection // doesn't have a handler, the events go to the reactor. // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_013: [The event handler shall create a Receiver (Proton) object and set the protocol tag on it to a predefined constant] // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_017: [The Receiver object shall have the properties set to service client version identifier.] Map<Symbol, Object> properties = new HashMap<>(); properties.put(Symbol.getSymbol(TransportUtils.versionIdentifierKey), TransportUtils.USER_AGENT_STRING); Receiver notificationReceiver = ssn.receiver(FILE_NOTIFICATION_RECEIVE_TAG); notificationReceiver.setProperties(properties); // Codes_SRS_SERVICE_SDK_JAVA_AMQPFILEUPLOADNOTIFICATIONRECEIVEDHANDLER_25_014: [The event handler shall open the Connection, the Session and the Receiver object] conn.open(); ssn.open(); notificationReceiver.open(); }
conn.setHostname(hostName);
/** * Event handler for the connection init event * @param event The Proton Event object. */ @Override public void onConnectionInit(Event event) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_025: [The event handler shall get the Connection (Proton) object from the event handler and set the host name on the connection.] this.connection = event.getConnection(); this.connection.setHostname(this.hostName); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_026: [The event handler shall create a Session (Proton) object from the connection.] this.session = this.connection.session(); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_027: [The event handler shall create a Receiver and Sender (Proton) links and set the protocol tag on them to a predefined constant.] this.receiver = this.session.receiver(receiveTag); this.sender = this.session.sender(sendTag); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_028: [The Receiver and Sender links shall have the properties set to client version identifier.] Map<Symbol, Object> properties = new HashMap<>(); properties.put(Symbol.getSymbol(versionIdentifierKey), TransportUtils.javaDeviceClientIdentifier + TransportUtils.clientVersion); this.receiver.setProperties(properties); this.sender.setProperties(properties); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_029: [The event handler shall open the connection, session, sender and receiver objects.] this.connection.open(); this.session.open(); receiver.open(); sender.open(); }
/** * Event handler for the connection init event * @param event The Proton Event object. */ @Override public void onConnectionInit(Event event) { logger.LogDebug("Entered in method %s", logger.getMethodName()); this.connection = event.getConnection(); this.connection.setHostname(this.fullHostAddress); this.session = this.connection.session(); this.connection.open(); this.session.open(); try { this.amqpDeviceOperations.openLinks(this.session); } catch (Exception e) { logger.LogDebug("openLinks has thrown exception: %s", e.getMessage()); } logger.LogDebug("Exited from method %s", logger.getMethodName()); }
if (conAddr != null) { Address addr = new Address(conAddr); connection.setHostname(addr.getHost()); connection.setHostname(null); } else {
/** * Event handler for the connection init event * @param event The Proton Event object. */ @Override public void onConnectionInit(Event event) { logger.LogDebug("Entered in method %s", logger.getMethodName()); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_025: [The event handler shall get the Connection (Proton) object from the event handler and set the host name on the connection.] this.connection = event.getConnection(); this.connection.setHostname(this.hostName); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_029: [The event handler shall open the connection.] this.connection.open(); try { // Codes_SRS_AMQPSIOTHUBCONNECTION_12_009: [The event handler shall call the amqpsSessionManager.onConnectionInit function with the connection.] this.amqpsSessionManager.onConnectionInit(this.connection); } catch (TransportException e) { this.savedException = e; logger.LogError(e); } logger.LogDebug("Exited from method %s", logger.getMethodName()); }
getEndpoint().setContainer(safeGetContainerId()); getEndpoint().setHostname(remoteURI.getHost()); if (!getDesiredCapabilities().isEmpty()) { getEndpoint().setDesiredCapabilities(getDesiredCapabilities().toArray(new Symbol[0]));
connection = new ConnectionImpl(); connection.setContainer(_name); connection.setHostname(host); connection.setContext(service); connector.setConnection(connection);
connection = Proton.connection(); connection.setContainer(_name); connection.setHostname(host); connection.setContext(new ConnectionContext(service, connector)); connector.setConnection(connection);
connection = Proton.connection(); connection.setContainer(_name); connection.setHostname(host); connection.setContext(new ConnectionContext(address, connector)); connector.setConnection(connection);
Collector collector = Proton.collector(); protonConnection.setContainer(or.clientId); protonConnection.setHostname(or.endpoint.getHost()); protonConnection.open(); Sasl sasl = transport.sasl();