Queue queue = binding.queue;
if (trace) log.trace("Destination for message[ID=" + ref.getMessage().getMessageID() + "] is: " + queue);
//Create a new delivery - note that it must have a delivery observer otherwise acknowledge will fail
Delivery del = new SimpleDelivery(queue, ref, true, true);
if (trace) log.trace("Acknowledging..");
try
{
// The actual jmx queue may not have been deployed yet, so we need to the core queue if so,
// or the acknowledge will have no effect
boolean deactivate = false;
if (!queue.isActive())
{
queue.activate();
deactivate = true;
}
del.acknowledge(tx);
if (deactivate)
{
queue.deactivate();
}