@Override public void run() { _connection.writeFrame(_txCommitOkFrame); } }, true);
@Override public void receiveConfirmSelect(final boolean nowait) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] ConfirmSelect [ nowait: " + nowait + " ]"); } _confirmOnPublish = true; if(!nowait) { _connection.writeFrame(new AMQFrame(_channelId, ConfirmSelectOkBody.INSTANCE)); } }
@Override public void onRollback() { final BasicNackBody body = new BasicNackBody(_deliveryTag, false, false); _connection.writeFrame(new AMQFrame(_channelId, body)); } });
@Override public void postCommit() { BasicAckBody body = _connection.getMethodRegistry() .createBasicAckBody( _deliveryTag, false); _connection.writeFrame(body.generateFrame(_channelId)); }
private void sendFlow(boolean flow) { MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createChannelFlowBody(flow); _connection.writeFrame(responseBody.generateFrame(_channelId)); }
@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 void receiveBasicCancel(final AMQShortString consumerTag, final boolean nowait) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] BasicCancel[" +" consumerTag: " + consumerTag + " noWait: " + nowait + " ]"); } unsubscribeConsumer(consumerTag); if (!nowait) { MethodRegistry methodRegistry = _connection.getMethodRegistry(); BasicCancelOkBody cancelOkBody = methodRegistry.createBasicCancelOkBody(consumerTag); sync(); _connection.writeFrame(cancelOkBody.generateFrame(_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 receiveTxRollback() { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] TxRollback"); } if (!isTransactional()) { closeChannel(ErrorCodes.COMMAND_INVALID, "Fatal error: rollback called on non-transactional channel"); } else { final MethodRegistry methodRegistry = _connection.getMethodRegistry(); final AMQMethodBody responseBody = methodRegistry.createTxRollbackOkBody(); Runnable task = () -> _connection.writeFrame(responseBody.generateFrame(_channelId)); rollback(task); // TODO: This is not spec compliant but we currently seem to rely on this behaviour resend(); } }
@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())); } }
@Override public void receiveAccessRequest(final AMQShortString realm, final boolean exclusive, final boolean passive, final boolean active, final boolean write, final boolean read) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] AccessRequest[" +" realm: " + realm + " exclusive: " + exclusive + " passive: " + passive + " active: " + active + " write: " + write + " read: " + read + " ]"); } MethodRegistry methodRegistry = _connection.getMethodRegistry(); if (ProtocolVersion.v0_91.equals(_connection.getProtocolVersion())) { _connection.sendConnectionClose(ErrorCodes.COMMAND_INVALID, "AccessRequest not present in AMQP versions other than 0-8, 0-9", _channelId); } else { // We don't implement access control class, but to keep clients happy that expect it // always use the "0" ticket. AccessRequestOkBody response = methodRegistry.createAccessRequestOkBody(0); sync(); _connection.writeFrame(response.generateFrame(_channelId)); } }
@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)); }
_connection.writeFrame(responseBody.generateFrame(_channelId));
_connection.writeFrame(responseBody.generateFrame(_channelId));
MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createQueuePurgeOkBody(purged); _connection.writeFrame(responseBody.generateFrame(getChannelId()));
MethodRegistry methodRegistry = _connection.getMethodRegistry(); AMQMethodBody responseBody = methodRegistry.createQueueBindOkBody(); _connection.writeFrame(responseBody.generateFrame(getChannelId()));
_connection.writeFrame(responseBody.generateFrame(getChannelId()));
_connection.writeFrame(responseBody.generateFrame(getChannelId()));
_connection.writeFrame(responseBody.generateFrame(getChannelId()));