private void addChannel(AMQChannel channel) { synchronized (_channelAddRemoveLock) { _channelMap.put(channel.getChannelId(), channel); if(_blocking) { channel.block(); } } }
@Override public void receiveChannelCloseOk() { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] ChannelCloseOk"); } _connection.closeChannelOk(getChannelId()); }
@Override public void receiveBasicQos(final long prefetchSize, final int prefetchCount, final boolean global) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] BasicQos[" +" prefetchSize: " + prefetchSize + " prefetchCount: " + prefetchCount + " global: " + global + " ]"); } sync(); setCredit(prefetchSize, prefetchCount); MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createBasicQosOkBody(); _connection.writeFrame(responseBody.generateFrame(getChannelId())); }
@Override public long deliverToClient(final ConsumerTarget_0_8 target, final AMQMessage message, final InstanceProperties props, final long deliveryTag) { int queueSize = _queue instanceof Queue ? ((Queue<?>)_queue).getQueueDepthMessages() : 0; long size = _connection.getProtocolOutputConverter().writeGetOk(message, props, AMQChannel.this.getChannelId(), deliveryTag, queueSize); _deliveredMessage = true; return size; }
void closeChannel(AMQChannel channel, int cause, String message, boolean mark) { int channelId = channel.getChannelId(); try { channel.close(cause, message); if(mark) { markChannelAwaitingCloseOk(channelId); } } finally { removeChannel(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())); }
@Override public void receiveChannelFlow(final boolean active) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] ChannelFlow[" +" active: " + active + " ]"); } sync(); if(_channelFlow != active) { _channelFlow = active; // inform consumer targets updateAllConsumerNotifyWorkDesired(); } setSuspended(!active); MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createChannelFlowOkBody(active); _connection.writeFrame(responseBody.generateFrame(getChannelId())); }
@Override public void receiveBasicRecover(final boolean requeue, final boolean sync) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] BasicRecover[" + " requeue: " + requeue + " sync: " + sync + " ]"); } if (requeue) { requeue(); } else { resend(); } if (sync) { MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody recoverOk = methodRegistry.createBasicRecoverSyncOkBody(); sync(); _connection.writeFrame(recoverOk.generateFrame(getChannelId())); } }
public void confirmAutoClose() { ProtocolOutputConverter converter = getChannel().getConnection().getProtocolOutputConverter(); converter.confirmConsumerAutoClose(getChannel().getChannelId(), getConsumerTag()); }
@Override public void closeChannelAndWriteFrame(AMQChannel channel, int cause, String message) { writeFrame(new AMQFrame(channel.getChannelId(), getMethodRegistry().createChannelCloseBody(cause, AMQShortString.validValueOf(message), _currentClassId, _currentMethodId))); closeChannel(channel, cause, message, true); }
_connection.sendConnectionClose(ErrorCodes.NOT_ALLOWED, "No queue specified.", getChannelId()); "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());
+ " of type " + ExchangeDefaults.DIRECT_EXCHANGE_CLASS + " to " + type + ".", getChannelId()); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); + " to " + type + ".", getChannelId()); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); "' which begins with reserved prefix.", getChannelId()); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); + exchangeName + "' of type " + exchange.getType() + " to " + type + ".", getChannelId()); _connection.writeFrame(declareOkBody.generateFrame(getChannelId())); + "' for exchange '" + exchangeName + "'", getChannelId()); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
"Default Exchange cannot be deleted", getChannelId()); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
"Cannot bind the queue '" + queueName + "' to the default exchange", getChannelId()); exch.getName(), e.getMessage()), getChannelId()); MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createQueueBindOkBody(); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
+ "' is exclusive, but not created on this Connection.", getChannelId()); queue.getQueueDepthMessages(), queue.getConsumerCount()); _connection.writeFrame(responseBody.generateFrame(getChannelId())); queue.getQueueDepthMessages(), queue.getConsumerCount()); _connection.writeFrame(responseBody.generateFrame(getChannelId())); + "' is exclusive, but not created on this Connection.", getChannelId()); queue.getQueueDepthMessages(), queue.getConsumerCount()); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId()); _connection.sendConnectionClose(ErrorCodes.NOT_FOUND, message, getChannelId()); _connection.sendConnectionClose(ErrorCodes.INVALID_ARGUMENT, message, getChannelId());
+ "' from the default exchange", getChannelId()); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
+ "' is exclusive, but not created on this Connection.", getChannelId()); _connection.writeFrame(responseBody.generateFrame(getChannelId())); _connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
_connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());
methodRegistry.createExchangeBoundOkBody(replyCode, AMQShortString.validValueOf(replyText)); _connection.writeFrame(exchangeBoundOkBody.generateFrame(getChannelId()));
_connection.sendConnectionClose(ErrorCodes.ACCESS_REFUSED, e.getMessage(), getChannelId());