Search in sources :

Example 61 with Reply

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

the class ConnectionConsumerImpl method close.

public void close() throws JMSException {
    if (closed)
        return;
    Reply reply = null;
    try {
        reply = requestRegistry.request(new CloseSessionRequest(dispatchId));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    deliveryQueue.stopQueue();
    deliveryQueue.close();
    myConnection.removeRequestService(myDispatchId);
    myConnection.removeConnectionConsumer(this);
    if (!reply.isOk()) {
        throw ExceptionConverter.convert(reply.getException());
    }
}
Also used : CloseSessionRequest(com.swiftmq.jms.smqp.v400.CloseSessionRequest) Reply(com.swiftmq.tools.requestreply.Reply) JMSException(javax.jms.JMSException)

Example 62 with Reply

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

the class MessageConsumerImpl method close.

private void close(String exception) throws JMSException {
    synchronized (this) {
        messageCache.clear();
        notify();
    }
    if (isClosed())
        return;
    closed = true;
    synchronized (mySession) {
        Reply reply = null;
        // must be released by the connection!
        try {
            reply = requestRegistry.request(new CloseConsumerRequest(dispatchId, dispatchId, serverQueueConsumerId, exception));
        } catch (Exception e) {
            throw ExceptionConverter.convert(e);
        }
        if (!reply.isOk()) {
            throw ExceptionConverter.convert(reply.getException());
        }
    }
    mySession.removeMessageConsumerImpl(this);
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply)

Example 63 with Reply

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

the class MessageProducerImpl method close.

/**
 * Since a provider may allocate some resources on behalf of a
 * MessageProducer outside the JVM, clients should close them when they
 * are not needed. Relying on garbage collection to eventually reclaim
 * these resources may not be timely enough.
 */
public void close() throws JMSException {
    if (closed || mySession.isClosed())
        return;
    closed = true;
    // Fix: 2.1.0
    if (producerId == -1)
        return;
    Reply reply = null;
    try {
        reply = requestRegistry.request(new CloseProducerRequest(dispatchId, producerId));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (!reply.isOk()) {
        throw ExceptionConverter.convert(reply.getException());
    }
}
Also used : ProduceMessageReply(com.swiftmq.jms.smqp.v400.ProduceMessageReply) Reply(com.swiftmq.tools.requestreply.Reply) CloseProducerRequest(com.swiftmq.jms.smqp.v400.CloseProducerRequest)

Example 64 with Reply

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

the class SMQPVisitorAdapter method visit.

public void visit(XAResPrepareRequest 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 65 with Reply

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

the class SMQPVisitorAdapter method visit.

public void visit(XAResCommitRequest 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)

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