Search in sources :

Example 11 with MessageProcessor

use of com.swiftmq.swiftlet.queue.MessageProcessor 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 12 with MessageProcessor

use of com.swiftmq.swiftlet.queue.MessageProcessor 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 13 with MessageProcessor

use of com.swiftmq.swiftlet.queue.MessageProcessor in project swiftmq-ce by iitsoftware.

the class NontransactedSession method visit.

public void visit(RecoverSessionRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRecoverSessionRequest");
    recoveryInProgress = true;
    RecoverSessionReply reply = (RecoverSessionReply) 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) {
                    if (ctx.traceSpace.enabled)
                        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRecoverSessionRequest, stopping message processor: " + mp);
                    mp.stop();
                    consumer.getReadTransaction().unregisterMessageProcessor(mp);
                }
                consumer.getReadTransaction().rollback();
                consumer.getTransaction().rollback();
            } catch (Exception e) {
                reply.setOk(false);
                reply.setException(e);
                break;
            }
        }
    }
    deliveredList.clear();
    GenericRequest gr = new GenericRequest(-1, false, reply);
    ctx.sessionQueue.enqueue(gr);
}
Also used : MessageProcessor(com.swiftmq.swiftlet.queue.MessageProcessor) GenericRequest(com.swiftmq.tools.requestreply.GenericRequest) QueueTransactionClosedException(com.swiftmq.swiftlet.queue.QueueTransactionClosedException)

Example 14 with MessageProcessor

use of com.swiftmq.swiftlet.queue.MessageProcessor 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)

Example 15 with MessageProcessor

use of com.swiftmq.swiftlet.queue.MessageProcessor 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)17 GenericRequest (com.swiftmq.tools.requestreply.GenericRequest)14 QueuePullTransaction (com.swiftmq.swiftlet.queue.QueuePullTransaction)3 RollbackReply (com.swiftmq.jms.smqp.v400.RollbackReply)1 RollbackReply (com.swiftmq.jms.smqp.v500.RollbackReply)1 RollbackReply (com.swiftmq.jms.smqp.v510.RollbackReply)1 RollbackReply (com.swiftmq.jms.smqp.v600.RollbackReply)1 RollbackReply (com.swiftmq.jms.smqp.v610.RollbackReply)1 RollbackReply (com.swiftmq.jms.smqp.v630.RollbackReply)1 RollbackReply (com.swiftmq.jms.smqp.v750.RollbackReply)1 QueueHandlerClosedException (com.swiftmq.swiftlet.queue.QueueHandlerClosedException)1 QueueTransactionClosedException (com.swiftmq.swiftlet.queue.QueueTransactionClosedException)1