use of org.apache.qpid.server.model.ConfiguredDerivedMethodAttribute in project qpid-broker-j by apache.
the class AbstractExchange method onOpen.
@Override
protected void onOpen() {
super.onOpen();
final ConfiguredDerivedMethodAttribute<Exchange<?>, Collection<Binding>> durableBindingsAttribute = (ConfiguredDerivedMethodAttribute<Exchange<?>, Collection<Binding>>) getModel().getTypeRegistry().getAttributeTypes(getTypeClass()).get(DURABLE_BINDINGS);
final Collection<Binding> bindings = durableBindingsAttribute.convertValue(getActualAttributes().get(DURABLE_BINDINGS), this);
if (bindings != null) {
_bindings.addAll(bindings);
for (Binding b : _bindings) {
final MessageDestination messageDestination = getOpenedMessageDestination(b.getDestination());
if (messageDestination != null) {
Map<String, Object> arguments = b.getArguments() == null ? Collections.emptyMap() : b.getArguments();
onBind(new BindingIdentifier(b.getBindingKey(), messageDestination), arguments);
messageDestination.linkAdded(this, b);
}
}
}
if (getLifetimePolicy() == LifetimePolicy.DELETE_ON_CREATING_LINK_CLOSE) {
if (_creatingLinkInfo != null) {
final LinkModel link;
if (_creatingLinkInfo.isSendingLink()) {
link = _virtualHost.getSendingLink(_creatingLinkInfo.getRemoteContainerId(), _creatingLinkInfo.getLinkName());
} else {
link = _virtualHost.getReceivingLink(_creatingLinkInfo.getRemoteContainerId(), _creatingLinkInfo.getLinkName());
}
addLifetimeConstraint(link);
} else {
throw new IllegalArgumentException("Exchanges created with a lifetime policy of " + getLifetimePolicy() + " must be created from a AMQP 1.0 link.");
}
}
if (getAlternateBinding() != null) {
String alternateDestination = getAlternateBinding().getDestination();
_alternateBindingDestination = getOpenedMessageDestination(alternateDestination);
if (_alternateBindingDestination != null) {
_alternateBindingDestination.addReference(this);
} else {
LOGGER.warn("Cannot find alternate binding destination '{}' for exchange '{}'", alternateDestination, toString());
}
}
getEventLogger().message(ExchangeMessages.CREATED(getType(), getName(), isDurable()));
}
Aggregations