/* if(!localTxn)
{
capabilities.add(TxnCapabilities.LOCAL_TXN);
}*/
final ReceivingLinkEndpoint receivingLinkEndpoint = (ReceivingLinkEndpoint) endpoint;
final TxnCoordinatorLink_1_0 coordinatorLink =
new TxnCoordinatorLink_1_0(_vhost, this, receivingLinkEndpoint, _openTransactions);
receivingLinkEndpoint.setLinkEventListener(coordinatorLink);
link = coordinatorLink;
}
else
{
ReceivingLink_1_0 previousLink =
(ReceivingLink_1_0) linkRegistry.getDurableReceivingLink(endpoint.getName());
if(previousLink == null)
{
Target target = (Target) endpoint.getTarget();
if(target != null)
{
if(Boolean.TRUE.equals(target.getDynamic()))
{
AMQQueue tempQueue = createTemporaryQueue(target.getDynamicNodeProperties());
target.setAddress(tempQueue.getName());
}
String addr = target.getAddress();
Exchange exchg = _vhost.getExchange(addr);
if(exchg != null)
{
destination = new ExchangeDestination(exchg, target.getDurable(),
target.getExpiryPolicy());
}
else
{
AMQQueue queue = _vhost.getQueue(addr);
if(queue != null)
{
destination = new QueueDestination(queue);
}
else
{
endpoint.setTarget(null);
destination = null;
}
}
}
else
{
destination = null;
}
if(destination != null)
{
final ReceivingLinkEndpoint receivingLinkEndpoint = (ReceivingLinkEndpoint) endpoint;
final ReceivingLink_1_0 receivingLink = new ReceivingLink_1_0(new ReceivingLinkAttachment(this, receivingLinkEndpoint), _vhost,
(ReceivingDestination) destination);
receivingLinkEndpoint.setLinkEventListener(receivingLink);
link = receivingLink;
if(TerminusDurability.UNSETTLED_STATE.equals(target.getDurable()))
{
linkRegistry.registerReceivingLink(endpoint.getName(), receivingLink);
}
}
}
else
{
ReceivingLinkEndpoint receivingLinkEndpoint = (ReceivingLinkEndpoint) endpoint;
previousLink.setLinkAttachment(new ReceivingLinkAttachment(this, receivingLinkEndpoint));
receivingLinkEndpoint.setLinkEventListener(previousLink);
link = previousLink;
endpoint.setLocalUnsettled(previousLink.getUnsettledOutcomeMap());
}
}