Java Code Examples for io.vertx.proton.ProtonConnection#setContainer()

The following examples show how to use io.vertx.proton.ProtonConnection#setContainer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PubSubBroker.java    From enmasse with Apache License 2.0 6 votes vote down vote up
private void connectHandler(ProtonConnection connection) {
    connection.setContainer(containerId);
    connection.openHandler(conn -> {
        log.info("[{}]: Connection opened", containerId);
    }).closeHandler(conn -> {
        connection.close();
        connection.disconnect();
        log.info("[{}]: Connection closed", containerId);
    }).disconnectHandler(protonConnection -> {
        connection.disconnect();
        log.debug("Disconnected");
    }).open();

    connection.sessionOpenHandler(ProtonSession::open);
    connection.senderOpenHandler(sender -> senderOpenHandler(connection, sender));
    connection.receiverOpenHandler(receiver -> receiverOpenHandler(connection, receiver));
}
 
Example 2
Source File: AmqpServiceBase.java    From hono with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Invoked when an AMQP <em>open</em> frame is received on the secure port.
 * <p>
 * This method
 * <ol>
 * <li>sets the container name</li>
 * <li>invokes {@link #setRemoteConnectionOpenHandler(ProtonConnection)}</li>
 * </ol>
 * <p>
 * Subclasses may override this method to set custom handlers.
 *
 * @param connection The AMQP connection that the frame is supposed to establish.
 */
protected void onRemoteConnectionOpen(final ProtonConnection connection) {
    connection.setContainer(String.format("%s-%s:%d", getServiceName(), getBindAddress(), getPort()));
    setRemoteConnectionOpenHandler(connection);
}
 
Example 3
Source File: AmqpServiceBase.java    From hono with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Invoked when an AMQP <em>open</em> frame is received on the insecure port.
 * <p>
 * This method
 * <ol>
 * <li>sets the container name</li>
 * <li>invokes {@link #setRemoteConnectionOpenHandler(ProtonConnection)}</li>
 * </ol>
 * <p>
 * Subclasses may override this method to set custom handlers.
 *
 * @param connection The AMQP connection that the frame is supposed to establish.
 * @throws NullPointerException if connection is {@code null}.
 */
protected void onRemoteConnectionOpenInsecurePort(final ProtonConnection connection) {
    connection.setContainer(String.format("%s-%s:%d", getServiceName(), getInsecurePortBindAddress(), getInsecurePort()));
    setRemoteConnectionOpenHandler(connection);
}