/** * Gets the (surrogate) identifier of the AMQP connection that a link is part of. * * @param link The link to determine the connection id for. * @return The identifier retrieved from the link's <em>attachment</em> using key {@link #KEY_CONNECTION_ID} * or {@code null} if the attachments do not contain a value for that a key. */ public static String getConnectionId(final ProtonLink<?> link) { return link.attachments().get(KEY_CONNECTION_ID, String.class); }
/** * Gets the (surrogate) identifier of the AMQP connection that a link is part of. * * @param link The link to determine the connection id for. * @return The identifier retrieved from the link's <em>attachment</em> using key {@link #KEY_CONNECTION_ID} * or {@code null} if the attachments do not contain a value for that a key. */ public static String getConnectionId(final ProtonLink<?> link) { return link.attachments().get(KEY_CONNECTION_ID, String.class); }
/** * Copies properties from a connection's attachments to a link's attachments. * <p> * The properties copied are * <ul> * <li>{@link #KEY_CONNECTION_ID}</li> * </ul> * * @param source The connection. * @param target The link. */ public static void copyProperties(final ProtonConnection source, final ProtonLink<?> target) { Objects.requireNonNull(source); Objects.requireNonNull(target); target.attachments().set(Constants.KEY_CONNECTION_ID, String.class, getConnectionId(source)); }
/** * Copies properties from a connection's attachments to a link's attachments. * <p> * The properties copied are * <ul> * <li>{@link #KEY_CONNECTION_ID}</li> * </ul> * * @param source The connection. * @param target The link. */ public static void copyProperties(final ProtonConnection source, final ProtonLink<?> target) { Objects.requireNonNull(source); Objects.requireNonNull(target); target.attachments().set(Constants.KEY_CONNECTION_ID, String.class, getConnectionId(source)); }