Search in sources :

Example 51 with Reply

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

the class SessionImpl method recover.

public synchronized void recover() throws JMSException {
    verifyState();
    if (!transacted) {
        startRecoverConsumers();
        Reply reply = null;
        try {
            reply = requestRegistry.request(new RecoverSessionRequest(dispatchId));
        } catch (Exception e) {
            throw ExceptionConverter.convert(e);
        }
        if (reply.isOk()) {
            endRecoverConsumers();
        } else {
            throw ExceptionConverter.convert(reply.getException());
        }
    } else {
        throw new javax.jms.IllegalStateException("Session is transacted - recover not allowed");
    }
}
Also used : IllegalStateException(javax.jms.IllegalStateException) Reply(com.swiftmq.tools.requestreply.Reply) IllegalStateException(javax.jms.IllegalStateException)

Example 52 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 {
    try {
        SwiftUtilities.verifyDurableName(durableName);
    } catch (Exception e) {
        throw new JMSException(e.getMessage());
    }
    Reply reply = null;
    try {
        reply = requestRegistry.request(new CreateDurableRequest(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 : CreateDurableRequest(com.swiftmq.jms.smqp.v510.CreateDurableRequest) Reply(com.swiftmq.tools.requestreply.Reply) CreateDurableReply(com.swiftmq.jms.smqp.v510.CreateDurableReply) CreateSubscriberReply(com.swiftmq.jms.smqp.v510.CreateSubscriberReply) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException)

Example 53 with Reply

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

the class QueueBrowserImpl method close.

/**
 * Since a provider may allocate some resources on behalf of a
 * QueueBrowser 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.
 *
 * @throws JMSException if a JMS fails to close this
 *                      Browser due to some JMS error.
 */
public void close() throws JMSException {
    verifyState();
    closed = true;
    Reply reply = null;
    try {
        reply = requestRegistry.request(new com.swiftmq.jms.smqp.v500.CloseBrowserRequest(dispatchId, browserDispatchId));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (!reply.isOk()) {
        throw ExceptionConverter.convert(reply.getException());
    }
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply) FetchBrowserMessageReply(com.swiftmq.jms.smqp.v500.FetchBrowserMessageReply) NoSuchElementException(java.util.NoSuchElementException) JMSException(javax.jms.JMSException)

Example 54 with Reply

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

the class SessionImpl method createShadowConsumer.

void createShadowConsumer(String queueName) throws Exception {
    Reply reply = requestRegistry.request(new CreateShadowConsumerRequest(dispatchId, queueName));
    if (!reply.isOk())
        throw reply.getException();
    shadowConsumerCreated = true;
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply)

Example 55 with Reply

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

the class TopicConnectionConsumerImpl method createSubscriber.

void createSubscriber(TopicImpl topic, String messageSelector) throws JMSException {
    Reply reply = null;
    try {
        reply = requestRegistry.request(new CreateSubscriberRequest(dispatchId, (TopicImpl) topic, messageSelector, false));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        queueName = ((CreateSubscriberReply) reply).getTmpQueueName();
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    fillCache();
}
Also used : Reply(com.swiftmq.tools.requestreply.Reply) CreateSubscriberReply(com.swiftmq.jms.smqp.v500.CreateSubscriberReply) CreateDurableReply(com.swiftmq.jms.smqp.v500.CreateDurableReply) CreateSubscriberRequest(com.swiftmq.jms.smqp.v500.CreateSubscriberRequest) 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