Search in sources :

Example 6 with CreateSessionReply

use of com.swiftmq.jms.smqp.v630.CreateSessionReply in project swiftmq-client by iitsoftware.

the class TopicConnectionImpl method createTopicSession.

public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
    verifyState();
    SessionImpl topicSession = null;
    CreateSessionReply reply = null;
    try {
        reply = (CreateSessionReply) requestRegistry.request(new CreateSessionRequest(0, transacted, acknowledgeMode, CreateSessionRequest.TOPIC_SESSION, 0));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        int dispatchId = reply.getSessionDispatchId();
        String cid = clientID != null ? clientID : internalCID;
        topicSession = new SessionImpl(SessionImpl.TYPE_TOPIC_SESSION, this, transacted, acknowledgeMode, dispatchId, requestRegistry, myHostname, cid);
        topicSession.setUserName(userName);
        topicSession.setMyDispatchId(addRequestService(topicSession));
        addSession(topicSession);
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    return (topicSession);
}
Also used : CreateSessionRequest(com.swiftmq.jms.smqp.v630.CreateSessionRequest) CreateSessionReply(com.swiftmq.jms.smqp.v630.CreateSessionReply) JMSException(javax.jms.JMSException)

Example 7 with CreateSessionReply

use of com.swiftmq.jms.smqp.v630.CreateSessionReply in project swiftmq-client by iitsoftware.

the class TopicConnectionImpl method createTopicSession.

public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
    verifyState();
    SessionImpl topicSession = null;
    CreateSessionReply reply = null;
    try {
        reply = (CreateSessionReply) requestRegistry.request(new CreateSessionRequest(0, transacted, acknowledgeMode, CreateSessionRequest.TOPIC_SESSION, 0));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        int dispatchId = reply.getSessionDispatchId();
        String cid = clientID != null ? clientID : internalCID;
        topicSession = new SessionImpl(SessionImpl.TYPE_TOPIC_SESSION, this, transacted, acknowledgeMode, dispatchId, requestRegistry, myHostname, cid);
        topicSession.setUserName(userName);
        topicSession.setMyDispatchId(addRequestService(topicSession));
        addSession(topicSession);
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    return (topicSession);
}
Also used : CreateSessionRequest(com.swiftmq.jms.smqp.v610.CreateSessionRequest) CreateSessionReply(com.swiftmq.jms.smqp.v610.CreateSessionReply) JMSException(javax.jms.JMSException)

Example 8 with CreateSessionReply

use of com.swiftmq.jms.smqp.v630.CreateSessionReply in project swiftmq-client by iitsoftware.

the class QueueConnectionImpl method createQueueSession.

public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException {
    verifyState();
    SessionImpl queueSession = null;
    CreateSessionReply reply = null;
    try {
        reply = (CreateSessionReply) requestRegistry.request(new CreateSessionRequest(0, transacted, acknowledgeMode, CreateSessionRequest.QUEUE_SESSION, 0));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        int dispatchId = reply.getSessionDispatchId();
        queueSession = new SessionImpl(SessionImpl.TYPE_QUEUE_SESSION, this, transacted, acknowledgeMode, dispatchId, requestRegistry, myHostname, null);
        queueSession.setUserName(getUserName());
        queueSession.setMyDispatchId(addRequestService(queueSession));
        addSession(queueSession);
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    return (queueSession);
}
Also used : CreateSessionRequest(com.swiftmq.jms.smqp.v600.CreateSessionRequest) CreateSessionReply(com.swiftmq.jms.smqp.v600.CreateSessionReply) IllegalStateException(javax.jms.IllegalStateException)

Example 9 with CreateSessionReply

use of com.swiftmq.jms.smqp.v630.CreateSessionReply in project swiftmq-client by iitsoftware.

the class TopicConnectionImpl method createTopicSession.

public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
    verifyState();
    SessionImpl topicSession = null;
    CreateSessionReply reply = null;
    try {
        reply = (CreateSessionReply) requestRegistry.request(new CreateSessionRequest(0, transacted, acknowledgeMode, CreateSessionRequest.TOPIC_SESSION, 0));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        int dispatchId = reply.getSessionDispatchId();
        String cid = clientID != null ? clientID : internalCID;
        topicSession = new SessionImpl(SessionImpl.TYPE_TOPIC_SESSION, this, transacted, acknowledgeMode, dispatchId, requestRegistry, myHostname, cid);
        topicSession.setUserName(userName);
        topicSession.setMyDispatchId(addRequestService(topicSession));
        addSession(topicSession);
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    return (topicSession);
}
Also used : CreateSessionRequest(com.swiftmq.jms.smqp.v600.CreateSessionRequest) CreateSessionReply(com.swiftmq.jms.smqp.v600.CreateSessionReply) JMSException(javax.jms.JMSException)

Example 10 with CreateSessionReply

use of com.swiftmq.jms.smqp.v630.CreateSessionReply in project swiftmq-client by iitsoftware.

the class TopicConnectionImpl method createTopicSession.

public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException {
    verifyState();
    SessionImpl topicSession = null;
    CreateSessionReply reply = null;
    try {
        reply = (CreateSessionReply) requestRegistry.request(new CreateSessionRequest(transacted, acknowledgeMode, CreateSessionRequest.TOPIC_SESSION));
    } catch (Exception e) {
        throw ExceptionConverter.convert(e);
    }
    if (reply.isOk()) {
        int dispatchId = reply.getSessionDispatchId();
        String cid = clientID != null ? clientID : internalCID;
        topicSession = new SessionImpl(SessionImpl.TYPE_TOPIC_SESSION, this, transacted, acknowledgeMode, dispatchId, requestRegistry, myHostname, cid);
        topicSession.setUserName(userName);
        topicSession.setMyDispatchId(addRequestService(topicSession));
        addSession(topicSession);
    } else {
        throw ExceptionConverter.convert(reply.getException());
    }
    return (topicSession);
}
Also used : CreateSessionRequest(com.swiftmq.jms.smqp.v500.CreateSessionRequest) CreateSessionReply(com.swiftmq.jms.smqp.v500.CreateSessionReply) JMSException(javax.jms.JMSException)

Aggregations

JMSException (javax.jms.JMSException)7 IllegalStateException (javax.jms.IllegalStateException)4 CreateSessionReply (com.swiftmq.jms.smqp.v600.CreateSessionReply)2 CreateSessionRequest (com.swiftmq.jms.smqp.v600.CreateSessionRequest)2 CreateSessionReply (com.swiftmq.jms.smqp.v610.CreateSessionReply)2 CreateSessionRequest (com.swiftmq.jms.smqp.v610.CreateSessionRequest)2 CreateSessionReply (com.swiftmq.jms.smqp.v630.CreateSessionReply)2 CreateSessionRequest (com.swiftmq.jms.smqp.v630.CreateSessionRequest)2 CreateSessionReply (com.swiftmq.jms.smqp.v750.CreateSessionReply)2 CreateSessionRequest (com.swiftmq.jms.smqp.v750.CreateSessionRequest)2 CreateSessionReply (com.swiftmq.jms.smqp.v400.CreateSessionReply)1 CreateSessionRequest (com.swiftmq.jms.smqp.v400.CreateSessionRequest)1 CreateSessionReply (com.swiftmq.jms.smqp.v500.CreateSessionReply)1 CreateSessionRequest (com.swiftmq.jms.smqp.v500.CreateSessionRequest)1 CreateSessionReply (com.swiftmq.jms.smqp.v510.CreateSessionReply)1 CreateSessionRequest (com.swiftmq.jms.smqp.v510.CreateSessionRequest)1