Search in sources :

Example 6 with RollbackReply

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

the class TransactedSession method visitRollbackRequest.

public void visitRollbackRequest(RollbackRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRollbackRequest");
    recoveryInProgress = true;
    RollbackReply reply = (RollbackReply) req.createReply();
    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(new javax.jms.JMSException(e.toString()));
                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.v500.RollbackReply) GenericRequest(com.swiftmq.tools.requestreply.GenericRequest)

Example 7 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(new javax.jms.JMSException(e.toString()));
    }
    recoveryInProgress = false;
    reply.send();
}
Also used : RollbackReply(com.swiftmq.jms.smqp.v500.RollbackReply)

Example 8 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.v630.RollbackReply)

Example 9 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.v630.RollbackReply) GenericRequest(com.swiftmq.tools.requestreply.GenericRequest)

Example 10 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.v750.RollbackReply) GenericRequest(com.swiftmq.tools.requestreply.GenericRequest) QueueHandlerClosedException(com.swiftmq.swiftlet.queue.QueueHandlerClosedException)

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