Search in sources :

Example 86 with Reply

use of com.swiftmq.tools.requestreply.Reply in project swiftmq-client by iitsoftware.

the class SMQPVisitorAdapter method visit.

public void visit(XAResRollbackRequest req) {
    Reply reply = req.createReply();
    reply.setOk(false);
    reply.setException(new Exception("Please install the JMS XA/ASF Swiftlet to use this functionality!"));
    reply.send();
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply)

Example 87 with Reply

use of com.swiftmq.tools.requestreply.Reply in project swiftmq-client by iitsoftware.

the class SMQPVisitorAdapter method visit.

public void visit(AssociateMessageRequest req) {
    Reply reply = req.createReply();
    reply.setOk(false);
    reply.setException(new Exception("Please install the JMS XA/ASF Swiftlet to use this functionality!"));
    reply.send();
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply)

Example 88 with Reply

use of com.swiftmq.tools.requestreply.Reply in project swiftmq-client by iitsoftware.

the class SMQPVisitorAdapter method visit.

public void visit(XAResRecoverRequest req) {
    Reply reply = req.createReply();
    reply.setOk(false);
    reply.setException(new Exception("Please install the JMS XA/ASF Swiftlet to use this functionality!"));
    reply.send();
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply)

Example 89 with Reply

use of com.swiftmq.tools.requestreply.Reply in project swiftmq-client by iitsoftware.

the class Connector method visit.

public void visit(PODataAvailable po) {
    if (debug)
        System.out.println(toString() + ", visit, po=" + po + " ...");
    DataInput in = po.getIn();
    try {
        Dumpable obj = Dumpalizer.construct(in, dumpableFactory);
        if (debug)
            System.out.println(toString() + ", dataAvailable, obj=" + obj);
        if (obj == null || obj.getDumpId() == SMQPFactory.DID_KEEPALIVE_REQ) {
            return;
        }
        if (!recreateStarted) {
            if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
                SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
                for (int i = 0; i < bulkRequest.len; i++) {
                    Dumpable dumpable = (Dumpable) bulkRequest.dumpables[i];
                    if (dumpable.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ)
                        setReply(dumpable);
                }
            } else
                setReply(obj);
            current = null;
        } else if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
            SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
            for (int i = 0; i < bulkRequest.len; i++) {
                Dumpable dumpable = (Dumpable) bulkRequest.dumpables[i];
                if (dumpable.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ) {
                    currentRecreatePO.getRecreatable().setRecreateReply((Reply) dumpable);
                    currentRecreatePO.setSuccess(true);
                    if (currentRecreatePO.getSemaphore() != null)
                        currentRecreatePO.getSemaphore().notifySingleWaiter();
                }
            }
        } else {
            currentRecreatePO.getRecreatable().setRecreateReply((Reply) obj);
            currentRecreatePO.setSuccess(true);
            if (currentRecreatePO.getSemaphore() != null)
                currentRecreatePO.getSemaphore().notifySingleWaiter();
        }
        currentRecreatePO = null;
        requestTime = -1;
    } catch (Exception e) {
        if (debug)
            System.out.println(toString() + ", visit, po=" + po + ", exception=" + e);
        if (currentRecreatePO != null) {
            currentRecreatePO.setSuccess(false);
            currentRecreatePO.setException(e.toString());
            if (currentRecreatePO.getSemaphore() != null)
                currentRecreatePO.getSemaphore().notifySingleWaiter();
            currentRecreatePO = null;
        }
        reconnector.invalidateConnection();
        connection = null;
        reconnectInProgress = false;
        currentRecreatePO = null;
        requestTime = -1;
        if (debug)
            System.out.println(toString() + ", (e instanceof JMSSecurityException)?" + (e instanceof JMSSecurityException));
        if (e instanceof JMSSecurityException) {
            if (sem != null)
                sem.notifySingleWaiter();
        } else {
            if (debug)
                System.out.println(toString() + ", e is instanceof " + e.getClass().getName());
            dispatch(new POReconnect(sem, recreatableConnection, true));
        }
    }
    if (debug)
        System.out.println(toString() + ", visit, po=" + po + " done");
}
Also used : LengthCaptureDataInput(com.swiftmq.tools.util.LengthCaptureDataInput) DataInput(java.io.DataInput) JMSSecurityException(javax.jms.JMSSecurityException) SMQPBulkRequest(com.swiftmq.jms.smqp.v610.SMQPBulkRequest) Reply(com.swiftmq.tools.requestreply.Reply) IOException(java.io.IOException) JMSSecurityException(javax.jms.JMSSecurityException) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 90 with Reply

use of com.swiftmq.tools.requestreply.Reply in project swiftmq-client by iitsoftware.

the class TopicConnectionConsumerImpl method createDurableSubscriber.

void createDurableSubscriber(TopicImpl topic, String messageSelector, String durableName) throws JMSException {
    this.topic = topic;
    this.messageSelector = messageSelector;
    this.durableName = durableName;
    isDurable = true;
    try {
        SwiftUtilities.verifyDurableName(durableName);
    } catch (Exception e) {
        throw new JMSException(e.getMessage());
    }
    Reply reply = null;
    try {
        reply = requestRegistry.request(new CreateDurableRequest(this, dispatchId, topic, messageSelector, false, durableName));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        queueName = ((CreateDurableReply) reply).getQueueName();
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    fillCache();
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException)

Aggregations

Reply (com.swiftmq.tools.requestreply.Reply)116 JMSException (javax.jms.JMSException)27 IllegalStateException (javax.jms.IllegalStateException)6 Dumpable (com.swiftmq.tools.dump.Dumpable)4 IOException (java.io.IOException)4 LengthCaptureDataInput (com.swiftmq.tools.util.LengthCaptureDataInput)3 DataInput (java.io.DataInput)3 NoSuchElementException (java.util.NoSuchElementException)3 JMSSecurityException (javax.jms.JMSSecurityException)3 InvalidVersionException (com.swiftmq.jms.InvalidVersionException)2 TopicImpl (com.swiftmq.jms.TopicImpl)2 CreateDurableReply (com.swiftmq.jms.smqp.v400.CreateDurableReply)2 CreateSubscriberReply (com.swiftmq.jms.smqp.v400.CreateSubscriberReply)2 CreateDurableReply (com.swiftmq.jms.smqp.v500.CreateDurableReply)2 CreateSubscriberReply (com.swiftmq.jms.smqp.v500.CreateSubscriberReply)2 CreateDurableReply (com.swiftmq.jms.smqp.v510.CreateDurableReply)2 CreateSubscriberReply (com.swiftmq.jms.smqp.v510.CreateSubscriberReply)2 CloseProducerRequest (com.swiftmq.jms.smqp.v400.CloseProducerRequest)1 CloseSessionRequest (com.swiftmq.jms.smqp.v400.CloseSessionRequest)1 CreateConsumerRequest (com.swiftmq.jms.smqp.v400.CreateConsumerRequest)1