@Override protected void establishLink(final Attach attach) throws AmqpErrorException { if (getSource() != null || getTarget() != null) { throw new IllegalStateException("LinkEndpoint and Termini should be null when establishing a Link."); } attachReceived(attach); }
@Override protected void resumeLink(final Attach attach) throws AmqpErrorException { if (getSource() == null) { throw new IllegalStateException("Terminus should be set when resuming a Link."); } if (attach.getSource() == null) { throw new IllegalStateException("Attach.getSource should not be null when resuming a Link. That would be recovering the Link."); } Source newSource = (Source) attach.getSource(); Source oldSource = getSource(); final SendingDestination destination = getSession().getSendingDestination(getLink(), oldSource); prepareConsumerOptionsAndFilters(destination); if (getDestination() instanceof ExchangeSendingDestination && !Boolean.TRUE.equals(newSource.getDynamic())) { final SendingDestination newDestination = getSession().getSendingDestination(getLink(), newSource); if (getSession().updateSourceForSubscription(this, newSource, newDestination)) { setDestination(newDestination); } } attachReceived(attach); }
@Override protected void reattachLink(final Attach attach) throws AmqpErrorException { if (getSource() == null) { throw new IllegalStateException("Terminus should be set when resuming a Link."); } if (attach.getSource() == null) { throw new IllegalStateException("Attach.getSource should not be null when resuming a Link. That would be recovering the Link."); } Source newSource = (Source) attach.getSource(); Source oldSource = getSource(); final SendingDestination destination = getSession().getSendingDestination(getLink(), oldSource); prepareConsumerOptionsAndFilters(destination); if (getDestination() instanceof ExchangeSendingDestination && !Boolean.TRUE.equals(newSource.getDynamic())) { final SendingDestination newDestination = getSession().getSendingDestination(getLink(), newSource); if (getSession().updateSourceForSubscription(this, newSource, newDestination)) { setDestination(newDestination); } } attachReceived(attach); }