private void doBlock() { for(Session_1_0 session : _sessions) { session.block(); } }
private ExchangeSendingDestination createExchangeDestination(String address, final String linkName, final Source source) throws AmqpErrorException { String[] parts = address.split("/", 2); String exchangeName = parts[0]; String bindingKey = parts[1]; return createExchangeDestination(exchangeName, bindingKey, linkName, source); }
public void receiveDetach(final Detach detach) { receivedComplete(); UnsignedInteger handle = detach.getHandle(); detach(handle, detach); }
Session_1_0 session = new Session_1_0(this, begin, sendingChannelId, receivingChannelId, getContextValue(Long.class, AMQPConnection_1_0.CONNECTION_SESSION_CREDIT_WINDOW_SIZE)); session.create(); beginToSend.setNextOutgoingId(session.getNextOutgoingId()); beginToSend.setOutgoingWindow(session.getOutgoingWindow()); beginToSend.setIncomingWindow(session.getIncomingWindow()); sendFrame(sendingChannelId, beginToSend); if (_blocking) session.block();
public void receiveAttach(final Attach attach) { receivedComplete(); if(_sessionState == SessionState.ACTIVE) { UnsignedInteger inputHandle = attach.getHandle(); if (_inputHandleToEndpoint.containsKey(inputHandle)) { String errorMessage = String.format("Input Handle '%d' already in use", inputHandle.intValue()); getConnection().close(new Error(SessionError.HANDLE_IN_USE, errorMessage)); throw new ConnectionScopedRuntimeException(errorMessage); } else { final Link_1_0<? extends BaseSource, ? extends BaseTarget> link; if (attach.getRole() == Role.RECEIVER) { link = getAddressSpace().getSendingLink(getConnection().getRemoteContainerId(), attach.getName()); } else { link = getAddressSpace().getReceivingLink(getConnection().getRemoteContainerId(), attach.getName()); } final ListenableFuture<? extends LinkEndpoint<?,?>> future = link.attach(this, attach); addFutureCallback(future, new EndpointCreationCallback(attach), MoreExecutors.directExecutor()); } } }
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); } }
? Collections.emptySet() : new HashSet<>(Arrays.asList(source.getCapabilities())); MessageSource tempSource = createDynamicSource(link, source.getDynamicNodeProperties(), sourceCapabilities); if(tempSource != null) destination = createExchangeDestination(address, link.getName(), source); MessageSource queue = getAddressSpace().getAttainedMessageSource(address); if (queue != null) destination = createExchangeDestination(address, null, link.getName(), source);
source.setFilter(attachSource.getFilter()); source.setCapabilities(attachSource.getCapabilities()); final SendingDestination destination = getSession().getSendingDestination(getLink(), source); source.setCapabilities(destination.getCapabilities()); getLink().setSource(source); _resumeAcceptedTransfers.clear(); _resumeFullTransfers.clear(); final NamedAddressSpace addressSpace = getSession().getConnection().getAddressSpace(); getSession().addDeleteTask(_cleanUpUnsettledDeliveryTask);
MessageDestination tempDestination = createDynamicDestination(link, target.getDynamicNodeProperties(), target.getCapabilities()); if(tempDestination != null) if (addr == null || "".equals(addr.trim())) destination = new AnonymousRelayDestination(getAddressSpace(), target, _connection.getEventLogger()); DestinationAddress destinationAddress = new DestinationAddress(getAddressSpace(), addr); MessageDestination messageDestination = destinationAddress.getMessageDestination();
private void detachLinks() { Collection<UnsignedInteger> handles = new ArrayList<>(_inputHandleToEndpoint.keySet()); for(UnsignedInteger handle : handles) { Detach detach = new Detach(); detach.setClosed(false); detach.setHandle(handle); detach.setError(_sessionEndedLinkError); detach(handle, detach); } }
try Map<String, Object> attributes = convertDynamicNodePropertiesToAttributes(link, properties, destName); return Subject.doAs(getSubjectWithAddedSystemRights(), (PrivilegedAction<MessageDestination>) () -> getAddressSpace().createMessageDestination(clazz, attributes));