use of com.swiftmq.impl.streams.comp.message.Message in project swiftmq-ce by iitsoftware.
the class StreamProcessor method visit.
@Override
public void visit(POMessage po) {
if (ctx.ctx.traceSpace.enabled)
ctx.ctx.traceSpace.trace(ctx.ctx.streamsSwiftlet.getName(), toString() + "/visit, po=" + po + " ...");
po.setSuccess(true);
msgsProcessed++;
try {
QueueMessageProcessor messageProcessor = po.getMessageProcessor();
if (messageProcessor.isValid()) {
ctx.addTransaction(messageProcessor.getTransaction(), null);
Input input = messageProcessor.getInput();
Message message = ctx.messageBuilder.wrap(messageProcessor.getMessage());
input.current(message).executeCallback();
if (message.isOnMessageEnabled()) {
long start = System.nanoTime();
ctx.stream.current(input.current()).executeOnMessageCallback();
timeOnMessage = (int) (System.nanoTime() - start) / 1000;
}
ctx.commitTransactions();
messageProcessor.restart();
}
} catch (Exception e) {
handleException(po, e);
}
if (po.getSemaphore() != null)
po.getSemaphore().notifySingleWaiter();
if (ctx.ctx.traceSpace.enabled)
ctx.ctx.traceSpace.trace(ctx.ctx.streamsSwiftlet.getName(), toString() + "/visit, po=" + po + " done");
}
Aggregations