@Override public boolean ignoreAllButCloseOk() { return _connection.ignoreAllButCloseOk() || _connection.channelAwaitingClosure(_channelId); }
@Override public void receiveChannelClose(final int replyCode, final AMQShortString replyText, final int classId, final int methodId) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] ChannelClose[" +" replyCode: " + replyCode + " replyText: " + replyText + " classId: " + classId + " methodId: " + methodId + " ]"); } sync(); _connection.closeChannel(this); _connection.writeFrame(new AMQFrame(getChannelId(), _connection.getMethodRegistry().createChannelCloseOkBody())); }
private void closeChannel(int cause, final String message) { _connection.closeChannelAndWriteFrame(this, cause, message); }
@Override public void receiveTxSelect() { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] TxSelect"); } ServerTransaction txn = _transaction; if (txn instanceof LocalTransaction) { getConnection().unregisterTransactionTickers(_transaction); } _transaction = _connection.createLocalTransaction(); long notificationRepeatPeriod = getContextValue(Long.class, TRANSACTION_TIMEOUT_NOTIFICATION_REPEAT_PERIOD); getConnection().registerTransactionTickers(_transaction, message -> _connection.sendConnectionCloseAsync(AMQPConnection.CloseReason.TRANSACTION_TIMEOUT, message), notificationRepeatPeriod); MethodRegistry methodRegistry = _connection.getMethodRegistry(); TxSelectOkBody responseBody = methodRegistry.createTxSelectOkBody(); _connection.writeFrame(responseBody.generateFrame(_channelId)); }
NamedAddressSpace vHost = _connection.getAddressSpace(); sync(); MessageSource queue = queueName == null ? getDefaultQueue() : vHost.getAttainedMessageSource(queueName.toString()); _connection.sendConnectionClose(ErrorCodes.NOT_FOUND, "No such queue, '" + queueName + "'", _channelId); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "No queue name provided, no default queue defined.", _channelId); MethodRegistry methodRegistry = _connection.getMethodRegistry(); _connection.writeFrame(responseBody.generateFrame(_channelId)); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), _channelId); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Queue has an exclusive consumer", _channelId); _connection.sendConnectionClose(ErrorCodes.INTERNAL_ERROR, "The GET request has been evaluated as an exclusive consumer, " + "this is likely due to a programming error in the Qpid broker", _channelId); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Queue has an incompatible exclusivity policy", _channelId); _connection.sendConnectionClose(ErrorCodes.NOT_FOUND, "Queue has been deleted", _channelId);
_connection.checkAuthorizedMessagePrincipal(AMQShortString.toString(contentHeader.getProperties().getUserId())); _publishAuthCache.authorisePublish(destination, routingKey, info.isImmediate(), _connection.getLastReadTime()); new MessageMetaData(info, contentHeader, getConnection().getLastReadTime()); final AMQMessage amqMessage = new AMQMessage(storedMessage, _connection.getReference()); try (MessageReference reference = amqMessage.newReference()) boolean closeOnNoRoute = _connection.isCloseWhenNoRoute(); if (LOGGER.isDebugEnabled()) && isTransactional() && !_confirmOnPublish && _connection.isCloseWhenNoRoute()) _connection.sendConnectionClose(errorCode, errorMessage, _channelId); _connection.writeFrame(new AMQFrame(_channelId, new BasicNackBody(_confirmedMessageCounter, false, _connection.writeFrame(new AMQFrame(_channelId, new BasicAckBody(_confirmedMessageCounter, false))); _connection.registerMessageReceived(bodySize);
public AMQChannel(AMQPConnection_0_8 connection, int channelId, final MessageStore messageStore) { super(connection, channelId); _creditManager = new Pre0_10CreditManager(0L, 0L, connection.getContextValue(Long.class, AMQPConnection_0_8.HIGH_PREFETCH_LIMIT), connection.getContextValue(Long.class, AMQPConnection_0_8.BATCH_LIMIT)); _unacknowledgedMessageMap = new UnacknowledgedMessageMapImpl(DEFAULT_PREFETCH, this); _connection = connection; _channelId = channelId; _messageStore = messageStore; _blockingTimeout = connection.getBroker().getContextValue(Long.class, Broker.CHANNEL_FLOW_CONTROL_ENFORCEMENT_TIMEOUT); // by default the session is non-transactional _transaction = new AsyncAutoCommitTransaction(_messageStore, this); MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createTxCommitOkBody(); _txCommitOkFrame = new CachedFrame(responseBody.generateFrame(_channelId)); _clientDeliveryMethod = connection.createDeliveryMethod(_channelId); AccessController.doPrivileged((new PrivilegedAction<Object>() { @Override public Object run() { message(ChannelMessages.CREATE()); return null; } }),_accessControllerContext); }
_connection.incrementTransactionRollbackCounter(); _connection.decrementTransactionOpenCounter(); _connection.unregisterTransactionTickers(_transaction);
NamedAddressSpace virtualHost = _connection.getAddressSpace(); MethodRegistry methodRegistry = _connection.getMethodRegistry(); methodRegistry.createExchangeBoundOkBody(replyCode, AMQShortString.validValueOf(replyText)); _connection.writeFrame(exchangeBoundOkBody.generateFrame(getChannelId()));
@Override public void receiveMessageContent(final QpidByteBuffer data) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] MessageContent[" +" data: " + hex(data,_connection.getBinaryDataLimit()) + " ] "); } if(hasCurrentMessage()) { publishContentBody(new ContentBody(data)); } else { _connection.sendConnectionClose(ErrorCodes.COMMAND_INVALID, "Attempt to send a content header without first sending a publish frame", _channelId); } }
NamedAddressSpace vHost = _connection.getAddressSpace(); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
public NamedAddressSpace getAddressSpace() { return getConnection().getAddressSpace(); }
@Override public void receiveChannelCloseOk() { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] ChannelCloseOk"); } _connection.closeChannelOk(getChannelId()); }
NamedAddressSpace virtualHost = _connection.getAddressSpace(); Queue<?> queue = null; if (queueName == null && (queue = getDefaultQueue()) == null) _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "No queue specified.", getChannelId()); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Queue is exclusive, but not created on this Connection.", getChannelId()); MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createQueuePurgeOkBody(purged); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
@Override final protected void doSend(final MessageInstanceConsumer consumer, final MessageInstance entry, final boolean batch) { ServerMessage serverMessage = entry.getMessage(); MessageConverter<ServerMessage<?>, AMQMessage> messageConverter = null; final AMQMessage msg; if(serverMessage instanceof AMQMessage) { msg = (AMQMessage) serverMessage; } else { messageConverter = MessageConverterRegistry.getConverter((Class<ServerMessage<?>>) serverMessage.getClass(), AMQMessage.class); msg = messageConverter.convert(serverMessage, getConnection().getAddressSpace()); } try { doSendInternal(consumer, entry, msg, batch); } finally { if(messageConverter != null) { messageConverter.dispose(msg); } } }
NamedAddressSpace vHost = _connection.getAddressSpace(); sync(); String queueName = AMQShortString.toString(queue); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "No queue name provided, no default queue defined.", _channelId); MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createBasicConsumeOkBody(consumerTag1); _connection.writeFrame(responseBody.generateFrame(_channelId)); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Non-unique consumer tag, '" + consumerTag1 + "'", _channelId); _connection.sendConnectionClose(ErrorCodes.ARGUMENT_INVALID, ise.getMessage(), _channelId); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, "Cannot subscribe to queue '" + queue1.getName() _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, "Cannot subscribe to queue '" + queue1.getName() _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, "Cannot subscribe to queue '" + queue1.getName() + "' permission denied", _channelId);
NamedAddressSpace virtualHost = _connection.getAddressSpace(); sync(); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Default Exchange cannot be deleted", getChannelId()); responseBody = _connection.getMethodRegistry().createExchangeDeleteOkBody(); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
NamedAddressSpace virtualHost = _connection.getAddressSpace(); sync(); Queue<?> queue; _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Queue '" + queue.getName() + "' is exclusive, but not created on this Connection.", getChannelId()); if (!nowait || _connection.isSendQueueDeleteOkRegardless()) MethodRegistry methodRegistry = _connection.getMethodRegistry(); QueueDeleteOkBody responseBody = methodRegistry.createQueueDeleteOkBody(purged); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
final MethodRegistry methodRegistry = _connection.getMethodRegistry(); final AMQMethodBody declareOkBody = methodRegistry.createExchangeDeclareOkBody(); NamedAddressSpace virtualHost = _connection.getAddressSpace(); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Attempt to redeclare default exchange: " + " of type " + ExchangeDefaults.DIRECT_EXCHANGE_CLASS _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Attempt to redeclare exchange: '" + exchangeName + "' of type " _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Attempt to declare exchange: '" + exchangeName + "' which begins with reserved prefix.", getChannelId()); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Attempt to redeclare exchange: '" + exchangeName + "' of type " + exchange.getType()
NamedAddressSpace virtualHost = _connection.getAddressSpace(); _connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "Cannot unbind the queue '" + queue.getName() + "' from the default exchange", getChannelId()); final AMQMethodBody responseBody = _connection.getMethodRegistry().createQueueUnbindOkBody(); sync(); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());