private MessageSource createDynamicSource(final Link_1_0<?, ?> link,
Map properties,
final Set<Symbol> capabilities) throws AmqpErrorException
{
final String queueName = "TempQueue" + UUID.randomUUID().toString();
try
{
Map<String, Object> attributes = convertDynamicNodePropertiesToAttributes(link, properties, queueName);
if (capabilities.contains(Symbol.valueOf("temporary-queue"))
|| capabilities.contains(Symbol.valueOf("temporary-topic")))
{
attributes.put(Queue.EXCLUSIVE, ExclusivityPolicy.CONNECTION);
}
return Subject.doAs(getSubjectWithAddedSystemRights(),
(PrivilegedAction<MessageSource>) () -> getAddressSpace().createMessageSource(MessageSource.class, attributes));
}
catch (AccessControlException e)
{
throw new AmqpErrorException(AmqpError.UNAUTHORIZED_ACCESS, e.getMessage());
}
catch (AbstractConfiguredObject.DuplicateNameException e)
{
LOGGER.error("A temporary queue was created with a name which collided with an existing queue name");
throw new ConnectionScopedRuntimeException(e);
}
}