qd = new QueueDestination(queue);
}
catch (QueueExistsException e)
{
_logger.error("A randomly generated temporary queue name collided with an existing queue",e);
throw new ConnectionScopedRuntimeException(e);
}
_target = new ConsumerTarget_1_0(this, true);
options.add(ConsumerImpl.Option.ACQUIRES);
options.add(ConsumerImpl.Option.SEES_REQUEUES);
}
else
{
throw new ConnectionScopedRuntimeException("Unknown destination type");
}
if(_target != null)
{
if(noLocal)
{
options.add(ConsumerImpl.Option.NO_LOCAL);
}
try
{
final String name;
if(getEndpoint().getTarget() instanceof Target)
{
Target target = (Target) getEndpoint().getTarget();
name = target.getAddress() == null ? getEndpoint().getName() : target.getAddress();
}
else
{
name = getEndpoint().getName();
}
_consumer = _queue.addConsumer(_target,
messageFilter == null ? null : new SimpleFilterManager(messageFilter),
Message_1_0.class, name, options);
}
catch (MessageSource.ExistingExclusiveConsumer e)
{
_logger.info("Cannot add a consumer to the destination as there is already an exclusive consumer");
throw new ConnectionScopedRuntimeException(e);
}
catch (MessageSource.ExistingConsumerPreventsExclusive e)
{
_logger.info("Cannot add an exclusive consumer to the destination as there is already a consumer");
throw new ConnectionScopedRuntimeException(e);
}
catch (MessageSource.ConsumerAccessRefused e)
{
_logger.info("Cannot add an exclusive consumer to the destination as there is an incompatible exclusivity policy");
throw new ConnectionScopedRuntimeException(e);
}
}
}