@Override public void registerAddressSpace(final NamedAddressSpace addressSpace) { _systemAddressSpaces.put(addressSpace.getName(), addressSpace); }
private Exchange<?> getExchange(NamedAddressSpace addressSpace, String exchangeName) { MessageDestination destination = addressSpace.getAttainedMessageDestination(exchangeName); return destination instanceof Exchange ? (Exchange<?>) destination : null; }
public MessageStore getMessageStore() { return getAddressSpace().getMessageStore(); }
if (routingAddress != null && !routingAddress.trim().equals("")) String localRoutingAddress = addressSpace.getLocalAddress(routingAddress); if (!localRoutingAddress.contains("/")) destination = addressSpace.getAttainedMessageDestination(localRoutingAddress); if (destination != null) destination = addressSpace.getAttainedMessageDestination(parts[0]); if (destination instanceof Exchange)
protected InternalMessage createMessage() { Map<String, Object> headers = new HashMap<>(); final List<String> globalAddressDomains = _addressSpace.getGlobalAddressDomains(); if (globalAddressDomains != null && !globalAddressDomains.isEmpty()) { String primaryDomain = globalAddressDomains.get(0); if(primaryDomain != null) { primaryDomain = primaryDomain.trim(); if(!primaryDomain.endsWith("/")) { primaryDomain += "/"; } headers.put("virtualHost.temporaryQueuePrefix", primaryDomain); } } InternalMessageHeader header = new InternalMessageHeader(headers, null, 0l, null, null, UUID.randomUUID().toString(), null, null, (byte) 4, System.currentTimeMillis(), 0L, null, null, System.currentTimeMillis()); final InternalMessage message = InternalMessage.createBytesMessage(_addressSpace.getMessageStore(), header, new byte[0]); message.setInitialRoutingAddress(getName()); return message; }
if (!addressSpace.isActive()) String redirectHost = addressSpace.getRedirectHost(getPort()); if(redirectHost != null) "Virtual host '" + addressSpace.getName() + "' is not active", 0); addressSpace.registerConnection(this, new NoopConnectionEstablishmentPolicy()); setAddressSpace(addressSpace); if(addressSpace.authoriseCreateConnection(this))
private void receiveOpenInternal(final NamedAddressSpace addressSpace) if (!addressSpace.isActive()) boolean registerSucceeded = addressSpace.registerConnection(this, (existingConnections, newConnection) -> if (!addressSpace.authoriseCreateConnection(this))
LOGGER.debug("Connecting to: {}", virtualHost.getName()); final AMQChannel channel = new AMQChannel(this, channelId, virtualHost.getMessageStore()); channel.create();
if (!addressSpace.isActive()) final String redirectHost = addressSpace.getRedirectHost(port); if(redirectHost == null) if(!addressSpace.authoriseCreateConnection(sconn.getAmqpConnection()))
+ queueName + "' not found on VirtualHost '" + virtualHost.getName() + "'."); queue = virtualHost.createMessageSource(Queue.class, attributes);
replyCode = virtualHost.hasMessageSources() ? ExchangeBoundOkBody.OK : ExchangeBoundOkBody.NO_BINDINGS; MessageSource queue = virtualHost.getAttainedMessageSource(queueName.toString()); if (queue == null) replyCode = virtualHost.getAttainedMessageDestination(routingKey.toString()) instanceof Queue ? ExchangeBoundOkBody.OK : ExchangeBoundOkBody.NO_QUEUE_BOUND_WITH_RK; MessageDestination destination = virtualHost.getAttainedMessageDestination(queueName.toString()); Queue<?> queue = destination instanceof Queue ? (Queue) destination : null; if (queue == null)
private Queue<?> getQueue(NamedAddressSpace addressSpace, String name) { MessageSource source = addressSpace.getAttainedMessageSource(name); return source instanceof Queue ? (Queue<?>) source : null; }
destination = vHost.getDefaultDestination(); destination = vHost.getAttainedMessageDestination(exchangeName.toString());
private void endpointClosed() { try { performDeleteTasks(); closeReceived(); } finally { NamedAddressSpace virtualHost = getAddressSpace(); if (virtualHost != null) { virtualHost.deregisterConnection(this); } } }
(PrivilegedAction<MessageDestination>) () -> getAddressSpace().createMessageDestination(clazz, attributes));
@Override public final void received(final QpidByteBuffer buf) { AccessController.doPrivileged((PrivilegedAction<Object>) () -> { updateLastReadTime(); try { onReceive(buf); } catch (StoreException e) { if (getAddressSpace().isActive()) { throw new ServerScopedRuntimeException(e); } else { throw new ConnectionScopedRuntimeException(e); } } return null; }, getAccessControllerContext()); }
private MessageSource createDynamicSource(final Link_1_0<?, ?> link, Map properties, final Set<Symbol> capabilities) throws AmqpErrorException { // TODO temporary topics? 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); } }
private void populateConnectionRedirect(final NamedAddressSpace addressSpace, final Error err) final String redirectHost = addressSpace.getRedirectHost(getPort());
private MessageSource getMessageSource(ServerSession session, String queue) { return getAddressSpace(session).getAttainedMessageSource(queue); }
if(xfr.hasDestination()) destination = addressSpace.getAttainedMessageDestination(xfr.getDestination()); if(destination == null) destination = addressSpace.getDefaultDestination(); && xfr.getHeader().getDeliveryProperties().getExchange() != null) destination = addressSpace.getAttainedMessageDestination(xfr.getHeader().getDeliveryProperties().getExchange()); destination = addressSpace.getDefaultDestination();