use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class Consumer method consume.
public void consume() {
sem = new Semaphore();
sem.waitHere();
if (exception != null)
failFast("failed: " + exception);
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class Consumer method consume.
public void consume() {
sem = new Semaphore();
sem.waitHere();
if (exception != null)
failFast("failed: " + exception);
try {
verifier.verify();
} catch (Exception e) {
failFast("failed: " + e);
}
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-ce by iitsoftware.
the class Consumer method consume.
public void consume() {
sem = new Semaphore();
sem.waitHere();
if (exception != null)
failFast("failed: " + exception);
try {
verifier.verify();
} catch (Exception e) {
failFast("failed: " + e);
}
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-client by iitsoftware.
the class Session method createConsumer.
/**
* Creates a temporary destination and a message consumer on it. The temporary destination has a lifetime of
* the connection.
*
* @param qoS quality of service
* @return message consumer
* @throws AMQPException on error
*/
public Consumer createConsumer(int linkCredit, int qoS) throws AMQPException {
verifyState();
QoS.verify(qoS);
Semaphore sem = new Semaphore();
POAttachConsumer po = new POAttachConsumer(sem, null, linkCredit, qoS, false, null, new DefaultDeliveryMemory());
sessionDispatcher.dispatch(po);
sem.waitHere();
if (!po.isSuccess())
throw new AMQPException(po.getException());
Consumer c = (Consumer) po.getLink();
links.add(c);
return c;
}
use of com.swiftmq.tools.concurrent.Semaphore in project swiftmq-client by iitsoftware.
the class Session method createConsumer.
/**
* Creates a message consumer on a source without a link credit. This is required for transactional acquisition.
*
* @param source the source, e.g. queue name
* @param qoS quality of service
* @param noLocal if true means it won't receive messages sent on the same topic and connection
* @param selector message selector (for SwiftMQ this would be a JMS message selector string)
* @return message consumer
* @throws AMQPException on error
*/
public Consumer createConsumer(String source, int qoS, boolean noLocal, String selector) throws AMQPException {
verifyState();
QoS.verify(qoS);
Semaphore sem = new Semaphore();
POAttachConsumer po = new POAttachConsumer(sem, source, -1, qoS, noLocal, selector, new DefaultDeliveryMemory());
sessionDispatcher.dispatch(po);
sem.waitHere();
if (!po.isSuccess())
throw new AMQPException(po.getException());
Consumer c = (Consumer) po.getLink();
links.add(c);
return c;
}
Aggregations