final Counter counter = new Counter(1);
endpoint.route(null, message, nh, new DeliveryNotification() {
public void sendFailed(MessageReceipt arg0, Exception arg1) {
log.warn("Failed to directly send a message", arg1);
counter.decrement();
}
public void sent(MessageReceipt arg0) {
counter.decrement();
}