Search in sources :

Example 11 with RollbackReply

use of com.swiftmq.jms.smqp.v510.RollbackReply in project swiftmq-ce by iitsoftware.

the class TransactedSession method visitGenericRequest.

public void visitGenericRequest(GenericRequest request) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitGenericRequest/RollbackReply");
    RollbackReply reply = (RollbackReply) request.getPayload();
    recoveryEpoche = reply.getRecoveryEpoche();
    try {
        transactionManager.rollback(false);
        purgeMarkedProducers();
        purgeMarkedConsumers();
        for (int i = 0; i < consumerList.size(); i++) {
            Consumer consumer = (Consumer) consumerList.get(i);
            if (consumer != null) {
                consumer.createReadTransaction();
                AsyncMessageProcessor mp = (AsyncMessageProcessor) consumer.getMessageProcessor();
                if (mp != null) {
                    int maxBulkSize = (int) (mp.getMaxBulkSize() / 1024);
                    mp = new AsyncMessageProcessor(this, ctx, consumer, mp.getConsumerCacheSize(), recoveryEpoche);
                    mp.setMaxBulkSize(maxBulkSize);
                    consumer.setMessageListener(consumer.getClientDispatchId(), consumer.getClientListenerId(), mp);
                    mp.register();
                }
            }
        }
        transactionManager.startTransactions();
    } catch (Exception e) {
        reply.setOk(false);
        reply.setException(e);
    }
    recoveryInProgress = false;
    reply.send();
}
Also used : RollbackReply(com.swiftmq.jms.smqp.v750.RollbackReply) QueueHandlerClosedException(com.swiftmq.swiftlet.queue.QueueHandlerClosedException)

Example 12 with RollbackReply

use of com.swiftmq.jms.smqp.v510.RollbackReply in project swiftmq-ce by iitsoftware.

the class TransactedSession method visitGenericRequest.

public void visitGenericRequest(GenericRequest request) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitGenericRequest/RollbackReply");
    RollbackReply reply = (RollbackReply) request.getPayload();
    recoveryEpoche++;
    try {
        transactionManager.rollback(false);
        purgeMarkedProducers();
        purgeMarkedConsumers();
        for (int i = 0; i < consumerList.size(); i++) {
            Consumer consumer = (Consumer) consumerList.get(i);
            if (consumer != null) {
                consumer.createReadTransaction();
                AsyncMessageProcessor mp = (AsyncMessageProcessor) consumer.getMessageProcessor();
                if (mp != null) {
                    mp = new AsyncMessageProcessor(this, ctx, consumer, mp.getConsumerCacheSize(), recoveryEpoche);
                    consumer.setMessageListener(consumer.getClientDispatchId(), consumer.getClientListenerId(), mp);
                    consumer.getReadTransaction().registerMessageProcessor(mp);
                }
            }
        }
        transactionManager.startTransactions();
    } catch (Exception e) {
        reply.setOk(false);
        reply.setException(e);
    }
    recoveryInProgress = false;
    reply.send();
}
Also used : RollbackReply(com.swiftmq.jms.smqp.v510.RollbackReply)

Example 13 with RollbackReply

use of com.swiftmq.jms.smqp.v510.RollbackReply in project swiftmq-ce by iitsoftware.

the class TransactedSession method visitGenericRequest.

public void visitGenericRequest(GenericRequest request) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitGenericRequest/RollbackReply");
    RollbackReply reply = (RollbackReply) request.getPayload();
    recoveryEpoche = reply.getRecoveryEpoche();
    try {
        transactionManager.rollback(false);
        purgeMarkedProducers();
        purgeMarkedConsumers();
        for (int i = 0; i < consumerList.size(); i++) {
            Consumer consumer = (Consumer) consumerList.get(i);
            if (consumer != null) {
                consumer.createReadTransaction();
                AsyncMessageProcessor mp = (AsyncMessageProcessor) consumer.getMessageProcessor();
                if (mp != null) {
                    mp = new AsyncMessageProcessor(this, ctx, consumer, mp.getConsumerCacheSize(), recoveryEpoche);
                    consumer.setMessageListener(consumer.getClientDispatchId(), consumer.getClientListenerId(), mp);
                    mp.register();
                }
            }
        }
        transactionManager.startTransactions();
    } catch (Exception e) {
        reply.setOk(false);
        reply.setException(e);
    }
    recoveryInProgress = false;
    reply.send();
}
Also used : RollbackReply(com.swiftmq.jms.smqp.v610.RollbackReply)

Example 14 with RollbackReply

use of com.swiftmq.jms.smqp.v510.RollbackReply in project swiftmq-ce by iitsoftware.

the class TransactedSession method visit.

public void visit(RollbackRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRollbackRequest");
    recoveryInProgress = true;
    RollbackReply reply = (RollbackReply) req.createReply();
    reply.setRecoveryEpoche(req.getRecoveryEpoche());
    reply.setOk(true);
    for (int i = 0; i < consumerList.size(); i++) {
        Consumer consumer = (Consumer) consumerList.get(i);
        if (consumer != null) {
            try {
                MessageProcessor mp = consumer.getMessageProcessor();
                if (mp != null) {
                    mp.stop();
                    consumer.getReadTransaction().unregisterMessageProcessor(mp);
                }
                consumer.getReadTransaction().rollback();
            } catch (Exception e) {
                reply.setOk(false);
                reply.setException(e);
                break;
            }
        }
    }
    GenericRequest gr = new GenericRequest(-1, false, reply);
    ctx.sessionQueue.enqueue(gr);
}
Also used : MessageProcessor(com.swiftmq.swiftlet.queue.MessageProcessor) RollbackReply(com.swiftmq.jms.smqp.v610.RollbackReply) GenericRequest(com.swiftmq.tools.requestreply.GenericRequest)

Aggregations

MessageProcessor (com.swiftmq.swiftlet.queue.MessageProcessor)7 GenericRequest (com.swiftmq.tools.requestreply.GenericRequest)7 RollbackReply (com.swiftmq.jms.smqp.v400.RollbackReply)2 RollbackReply (com.swiftmq.jms.smqp.v500.RollbackReply)2 RollbackReply (com.swiftmq.jms.smqp.v510.RollbackReply)2 RollbackReply (com.swiftmq.jms.smqp.v600.RollbackReply)2 RollbackReply (com.swiftmq.jms.smqp.v610.RollbackReply)2 RollbackReply (com.swiftmq.jms.smqp.v630.RollbackReply)2 RollbackReply (com.swiftmq.jms.smqp.v750.RollbackReply)2 QueueHandlerClosedException (com.swiftmq.swiftlet.queue.QueueHandlerClosedException)2