Search in sources :

Example 1 with Input

use of com.swiftmq.impl.streams.comp.io.Input 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");
}
Also used : Input(com.swiftmq.impl.streams.comp.io.Input) QueueWireTapInput(com.swiftmq.impl.streams.comp.io.QueueWireTapInput) ManagementInput(com.swiftmq.impl.streams.comp.io.ManagementInput) Message(com.swiftmq.impl.streams.comp.message.Message)

Aggregations

Input (com.swiftmq.impl.streams.comp.io.Input)1 ManagementInput (com.swiftmq.impl.streams.comp.io.ManagementInput)1 QueueWireTapInput (com.swiftmq.impl.streams.comp.io.QueueWireTapInput)1 Message (com.swiftmq.impl.streams.comp.message.Message)1