private Queue createAndBindQueueWithFlowControlEnabled(Session session, String queueName, int capacity, int resumeCapacity) throws Exception
{
final Map<String, Object> arguments = new HashMap<String, Object>();
arguments.put("x-qpid-capacity", capacity);
arguments.put("x-qpid-flow-resume-capacity", resumeCapacity);
((AMQSession<?, ?>) session).createQueue(new AMQShortString(queueName), false, true, false, arguments);
Queue queue = session.createQueue("direct://amq.direct/" + queueName + "/" + queueName + "?durable='" + true
+ "'&autodelete='" + false + "'");
((AMQSession<?, ?>) session).declareAndBind((AMQDestination) queue);
return queue;
}