use of org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerSenderContext in project activemq-artemis by apache.
the class AMQPSessionCallback method disconnect.
@Override
public void disconnect(ServerConsumer consumer, SimpleString queueName) {
ErrorCondition ec = new ErrorCondition(AmqpSupport.RESOURCE_DELETED, "Queue was deleted: " + queueName);
connection.lock();
try {
((ProtonServerSenderContext) consumer.getProtocolContext()).close(ec);
connection.flush();
} catch (ActiveMQAMQPException e) {
logger.error("Error closing link for " + consumer.getQueue().getAddress());
} finally {
connection.unlock();
}
}
use of org.apache.activemq.artemis.protocol.amqp.proton.ProtonServerSenderContext in project activemq-artemis by apache.
the class AMQPSessionCallback method onFlowConsumer.
public void onFlowConsumer(Object consumer, int credits, final boolean drain) {
ServerConsumerImpl serverConsumer = (ServerConsumerImpl) consumer;
if (drain) {
// If the draining is already running, then don't do anything
if (draining.compareAndSet(false, true)) {
final ProtonServerSenderContext plugSender = (ProtonServerSenderContext) serverConsumer.getProtocolContext();
serverConsumer.forceDelivery(1, new Runnable() {
@Override
public void run() {
try {
plugSender.reportDrained();
} finally {
draining.set(false);
}
}
});
}
} else {
serverConsumer.receiveCredits(-1);
}
}
Aggregations