use of com.swiftmq.swiftlet.queue.AbstractQueue in project swiftmq-ce by iitsoftware.
the class ClusteredQueue method createPushTransaction.
public Object createPushTransaction() throws QueueException {
ClusteredTransactionId txId = null;
if (dispatchPolicy.isMessageBasedDispatch()) {
txId = new ClusteredTransactionId(ctx, true);
} else {
String queueName = dispatchPolicy.getNextSendQueue();
if (ctx.queueSpace.enabled)
ctx.queueSpace.trace(getQueueName(), toString() + "/createPushTransaction, nextSendQueue=" + queueName);
if (queueName == null)
throw new QueueException("Unable to select a physical destination queue for this clustered queue!");
AbstractQueue queue = ctx.queueManager.getQueueForInternalUse(queueName, true);
txId = new ClusteredTransactionId(ctx, queue, queue.createPushTransaction(), new QueueImpl(queueName));
}
return txId;
}
use of com.swiftmq.swiftlet.queue.AbstractQueue in project swiftmq-ce by iitsoftware.
the class ClusteredTransactionId method putMessage.
public void putMessage(String queueName, MessageImpl message) throws Exception {
Entry entry = queueMap.get(queueName);
if (entry == null) {
AbstractQueue abstractQueue = ctx.queueManager.getQueueForInternalUse(queueName);
QueueImpl destination = new QueueImpl(queueName);
Object transaction = abstractQueue.createPushTransaction();
entry = new Entry(abstractQueue, destination, transaction);
queueMap.put(queueName, entry);
}
message.setJMSDestination(entry.destination);
message.setSourceRouter(null);
message.setDestRouter(null);
message.setDestQueue(queueName);
entry.abstractQueue.putMessage(entry.transaction, message);
}
use of com.swiftmq.swiftlet.queue.AbstractQueue in project swiftmq-ce by iitsoftware.
the class QueueCleanupJob method start.
public void start(Properties properties, JobTerminationListener jobTerminationListener) throws JobException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/start, properties=" + properties + " ...");
this.properties = properties;
if (stopCalled) {
terminate();
return;
}
try {
String predicate = properties.getProperty("Queue Name Predicate");
String[] names = ctx.queueManager.getDefinedQueueNames();
if (names != null) {
for (int i = 0; i < names.length; i++) {
if (!names[i].startsWith("tpc$")) {
if (LikeComparator.compare(names[i], predicate, '\\')) {
try {
AbstractQueue queue = ctx.queueManager.getQueueForInternalUse(names[i]);
if (queue != null) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/cleanup: " + names[i]);
queue.cleanUpExpiredMessages();
}
} catch (QueueException e) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/cleanup: " + names[i] + ", exception=" + e);
}
}
}
if (stopCalled)
break;
}
}
} catch (Exception e) {
terminate();
throw new JobException(e.toString(), e, false);
}
terminate();
jobTerminationListener.jobTerminated();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/start, properties=" + properties + " done");
}
use of com.swiftmq.swiftlet.queue.AbstractQueue in project swiftmq-ce by iitsoftware.
the class QueueResetJob method start.
public void start(Properties properties, JobTerminationListener jobTerminationListener) throws JobException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/start, properties=" + properties + " ...");
this.properties = properties;
if (stopCalled) {
terminate();
return;
}
try {
String predicate = properties.getProperty("Queue Name Predicate");
String[] names = ctx.queueManager.getDefinedQueueNames();
if (names != null) {
for (int i = 0; i < names.length; i++) {
if (LikeComparator.compare(names[i], predicate, '\\')) {
AbstractQueue queue = ctx.queueManager.getQueueForInternalUse(names[i]);
if (queue != null) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/reset: " + names[i]);
queue.resetCounters();
}
}
if (stopCalled)
break;
}
}
} catch (Exception e) {
terminate();
throw new JobException(e.toString(), e, false);
}
terminate();
jobTerminationListener.jobTerminated();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/start, properties=" + properties + " done");
}
use of com.swiftmq.swiftlet.queue.AbstractQueue in project swiftmq-ce by iitsoftware.
the class QueueWireTapInput method start.
@Override
public void start() throws Exception {
if (selector != null) {
messageSelector = new MessageSelector(selector);
messageSelector.compile();
}
queue = new ArrayBlockingQueue<MessageImpl>(bufferSize);
AbstractQueue queue = ctx.ctx.queueManager.getQueueForInternalUse(destinationName);
if (queue == null)
throw new Exception("Queue '" + destinationName + "' is undefined!");
queue.addWireTapSubscriber(name, this);
started = true;
}
Aggregations