@Override public void onAuthSuccess(final ProtonHandler protonHandler, final Connection connection) { connection.open(); }
@Override public void onAuthSuccess(final ProtonHandler protonHandler, final Connection connection) { connection.open(); }
@Override public ProtonConnection open() { connection.open(); flush(); 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(); }
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 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); } } }
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 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 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(); }
@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(); }
conn.open(); ssn.open(); snd.open();
@Override public void clientOpen(ClientSASL sasl) throws Exception { FutureRunnable future = new FutureRunnable(1); synchronized (handler.getLock()) { this.afterInit(future); if (sasl != null) { handler.createClientSasl(sasl); } handler.getConnection().open(); } flush(); waitWithTimeout(future); }
/** * 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()); }
/** * 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()); }
sasl.setMechanisms(new String[]{"ANONYMOUS"}); connection.open();
sasl.setMechanisms(new String[]{"ANONYMOUS"}); connection.open();