/** * Event handler for reactor init event. * @param event Proton Event object */ @Override public void onReactorInit(Event event) { // Codes_SRS_AMQPSIOTHUBCONNECTION_15_033: [The event handler shall set the current handler to handle the connection events.] if(this.useWebSockets) { event.getReactor().connectionToHost(this.config.getIotHubHostname(), amqpWebSocketPort, this); } else { event.getReactor().connectionToHost(this.config.getIotHubHostname(), amqpPort, this); } }
@Override public void onReactorInit(Event e) { super.onReactorInit(e); final Reactor r = e.getReactor(); connection = r.connectionToHost( connectionHandler.getRemoteHostName(), connectionHandler.getRemotePort(), connectionHandler); } }
@Override public void onReactorInit(Event e) { super.onReactorInit(e); final Reactor r = e.getReactor(); TRACE_LOGGER.info("Creating connection to host '{}:{}'", connectionHandler.getOutboundSocketHostName(), connectionHandler.getOutboundSocketPort()); connection = r.connectionToHost( connectionHandler.getOutboundSocketHostName(), connectionHandler.getOutboundSocketPort(), connectionHandler); } };
/** * Event handler for reactor init event. * @param event Proton Event object */ @Override public void onReactorInit(Event event) { logger.LogDebug("Entered in method %s", logger.getMethodName()); event.getReactor().connectionToHost(this.hostName, this.useWebSockets ? AMQP_WEB_SOCKET_PORT : AMQP_PORT, this); logger.LogDebug("Exited from method %s", logger.getMethodName()); }
Connection getConnection() { if (this.connection == null || this.connection.getLocalState() == EndpointState.CLOSED || this.connection.getRemoteState() == EndpointState.CLOSED) { TRACE_LOGGER.info("Creating connection to host '{}:{}'", this.connectionHandler.getOutboundSocketHostName(), this.connectionHandler.getOutboundSocketPort()); this.connection = this.getReactor().connectionToHost( this.connectionHandler.getOutboundSocketHostName(), this.connectionHandler.getOutboundSocketPort(), this.connectionHandler); } return this.connection; }
/** * Event handler for reactor init event. * @param event Proton Event object */ @Override public void onReactorInit(Event event) { logger.LogDebug("Entered in method %s", logger.getMethodName()); // Codes_SRS_AMQPSIOTHUBCONNECTION_15_033: [The event handler shall set the current handler to handle the connection events.] if(this.useWebSockets) { event.getReactor().connectionToHost(this.chooseHostname(), AMQP_WEB_SOCKET_PORT, this); } else { event.getReactor().connectionToHost(this.chooseHostname(), AMQP_PORT, this); } logger.LogDebug("Exited from method %s", logger.getMethodName()); }
@Override public Session getSession(final String path, final Consumer<Session> onRemoteSessionOpen, final BiConsumer<ErrorCondition, Exception> onRemoteSessionOpenError) { if (this.getIsClosingOrClosed()) { onRemoteSessionOpenError.accept(null, new OperationCancelledException("underlying messagingFactory instance is closed")); return null; } if (this.connection == null || this.connection.getLocalState() == EndpointState.CLOSED || this.connection.getRemoteState() == EndpointState.CLOSED) { this.connection = this.getReactor().connectionToHost( this.connectionHandler.getRemoteHostName(), this.connectionHandler.getRemotePort(), this.connectionHandler); } final Session session = this.connection.session(); BaseHandler.setHandler(session, new SessionHandler(path, onRemoteSessionOpen, onRemoteSessionOpenError, this.operationTimeout)); session.open(); return session; }