try
{
String address = getSession().toAddress(getDestination());
String targetAddress = getDestination().getLocalTerminus() != null ? getDestination().getLocalTerminus() : UUID.randomUUID().toString();
Receiver receiver = getSession().getClientSession().createReceiver(address, targetAddress,
StdDistMode.COPY, AcknowledgeMode.ALO,
getLinkName(), isDurable(), getFilters(),
null);
String actualAddress = receiver.getAddress();
@SuppressWarnings("unchecked")
Map<Symbol, Filter> actualFilters = (Map<Symbol, Filter>) receiver.getFilter();
if(!address.equals(actualAddress) || !filtersEqual(getFilters(), actualFilters))
{
receiver.close();
if(isDurable())
{
receiver = getSession().getClientSession().createReceiver(address,
StdDistMode.COPY, AcknowledgeMode.ALO,
getLinkName(), false, getFilters(),
null);
receiver.close();
}
receiver = getSession().getClientSession().createReceiver(address,
StdDistMode.COPY, AcknowledgeMode.ALO,
getLinkName(), isDurable(), getFilters(),
null);