use of org.apache.qpid.server.virtualhost.UnknownAlternateBindingException in project qpid-broker-j by apache.
the class AbstractExchange method validateOrCreateAlternateBinding.
private void validateOrCreateAlternateBinding(final Exchange<?> exchange, final boolean mayCreate) {
Object value = exchange.getAttribute(ALTERNATE_BINDING);
if (value instanceof AlternateBinding) {
AlternateBinding alternateBinding = (AlternateBinding) value;
String destinationName = alternateBinding.getDestination();
MessageDestination messageDestination = _virtualHost.getAttainedMessageDestination(destinationName, mayCreate);
if (messageDestination == null) {
throw new UnknownAlternateBindingException(destinationName);
} else if (messageDestination == this) {
throw new IllegalConfigurationException(String.format("Cannot create alternate binding for '%s' : Alternate binding destination cannot refer to self.", getName()));
} else if (isDurable() && !messageDestination.isDurable()) {
throw new IllegalConfigurationException(String.format("Cannot create alternate binding for '%s' : Alternate binding destination '%s' is not durable.", getName(), destinationName));
}
}
}
Aggregations