Search in sources :

Example 21 with Request

use of com.swiftmq.tools.requestreply.Request in project swiftmq-ce by iitsoftware.

the class InboundReader method dataAvailable.

public void dataAvailable(Connection connection, InputStream inputStream) throws IOException {
    dis.setInputStream(inputStream);
    Dumpable obj = Dumpalizer.construct(dis, dumpableFactory);
    if (traceSpace.enabled)
        traceSpace.trace("smqp", "read object: " + obj);
    if (obj.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ) {
        if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
            SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
            for (int i = 0; i < bulkRequest.len; i++) {
                Request req = (Request) bulkRequest.dumpables[i];
                if (req.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ)
                    dispatch(req);
            }
        } else
            dispatch((Request) obj);
    }
}
Also used : SMQPBulkRequest(com.swiftmq.jms.smqp.v510.SMQPBulkRequest) Request(com.swiftmq.tools.requestreply.Request) SMQPBulkRequest(com.swiftmq.jms.smqp.v510.SMQPBulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 22 with Request

use of com.swiftmq.tools.requestreply.Request in project swiftmq-ce by iitsoftware.

the class InboundReader method dataAvailable.

public void dataAvailable(Connection connection, InputStream inputStream) throws IOException {
    dis.setInputStream(inputStream);
    Dumpable obj = Dumpalizer.construct(dis, dumpableFactory);
    if (traceSpace.enabled)
        traceSpace.trace("smqp", "read object: " + obj);
    if (obj.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ) {
        if (obj.getDumpId() == SMQPFactory.DID_BULK_REQ) {
            SMQPBulkRequest bulkRequest = (SMQPBulkRequest) obj;
            for (int i = 0; i < bulkRequest.len; i++) {
                Request req = (Request) bulkRequest.dumpables[i];
                if (req.getDumpId() != SMQPFactory.DID_KEEPALIVE_REQ)
                    dispatch(req);
                else
                    resetKeepaliveCount();
            }
        } else
            dispatch((Request) obj);
    } else
        resetKeepaliveCount();
}
Also used : SMQPBulkRequest(com.swiftmq.jms.smqp.v600.SMQPBulkRequest) Request(com.swiftmq.tools.requestreply.Request) SMQPBulkRequest(com.swiftmq.jms.smqp.v600.SMQPBulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 23 with Request

use of com.swiftmq.tools.requestreply.Request in project swiftmq-ce by iitsoftware.

the class DispatcherImpl method visit.

public void visit(ClientRequest event) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(ctx.mgmtSwiftlet.getName(), toString() + "/visit, event: " + event);
    try {
        dis.reset();
        dis.setBuffer(event.getBuffer());
        Request request = (Request) Dumpalizer.construct(dis, factory);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.mgmtSwiftlet.getName(), toString() + "/visit, event: " + event + ", request: " + request);
        request.accept(this);
    } catch (Exception e) {
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.mgmtSwiftlet.getName(), toString() + "/visit, event: " + event + ", exception: " + e);
        ctx.logSwiftlet.logError(ctx.mgmtSwiftlet.getName(), toString() + "/visit, event: " + event + ", exception: " + e);
        valid = false;
    }
}
Also used : Request(com.swiftmq.tools.requestreply.Request)

Example 24 with Request

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

the class XAResourceImpl method prepare.

public synchronized int prepare(Xid xid) throws XAException {
    if (logWriter != null)
        log(toString() + "/prepare, xid=" + xid);
    XidImpl sxid = toSwiftMQXid(xid);
    XAResPrepareReply reply = null;
    try {
        int connectionId = session.getSessionImpl().getMyConnection().getConnectionId();
        Request request = new XAResPrepareRequest(this, session.getDispatchId(), sxid, false, endRequestInDoubt() ? XARecoverRegistry.getInstance().getRequestList(sxid) : null);
        request.setConnectionId(connectionId);
        reply = (XAResPrepareReply) session.request(request);
    } catch (Exception e) {
        XAException ex = new XAException(e.toString());
        ex.errorCode = XAException.XAER_RMFAIL;
        throw ex;
    }
    if (!reply.isOk()) {
        XAException ex = new XAException(reply.getException().getMessage());
        ex.errorCode = reply.getErrorCode();
        throw ex;
    }
    XARecoverRegistry.getInstance().clear(sxid);
    return XA_OK;
}
Also used : XAException(javax.transaction.xa.XAException) XidImpl(com.swiftmq.jms.XidImpl) Request(com.swiftmq.tools.requestreply.Request) ValidationException(com.swiftmq.tools.requestreply.ValidationException) JMSException(javax.jms.JMSException) XAException(javax.transaction.xa.XAException)

Example 25 with Request

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

the class XAResourceImpl method start.

public synchronized void start(Xid xid, int flags) throws XAException {
    if (logWriter != null)
        log(toString() + "/start, xid=" + xid + ", flags=" + flags);
    XidImpl sxid = toSwiftMQXid(xid);
    XAResStartReply reply = null;
    int connectionId = session.getSessionImpl().getMyConnection().getConnectionId();
    Request request = new XAResStartRequest(this, session.getDispatchId(), sxid, flags, false, null);
    request.setConnectionId(connectionId);
    try {
        reply = (XAResStartReply) session.request(request);
    } catch (Exception e) {
        XAException ex = new XAException(e.toString());
        ex.errorCode = XAException.XAER_RMFAIL;
        throw ex;
    }
    if (!reply.isOk()) {
        XAException ex = new XAException(reply.getException().getMessage());
        ex.errorCode = reply.getErrorCode();
        throw ex;
    } else {
        XARecoverRegistry.getInstance().addRequest(sxid, request);
        try {
            session.session.assignLastMessage();
        } catch (Exception e) {
            XAException ex = new XAException(reply.getException().getMessage());
            ex.errorCode = reply.getErrorCode();
            throw ex;
        }
    }
    if (completionListener != null)
        completionListener.transactionStarted(sxid, session);
}
Also used : XAException(javax.transaction.xa.XAException) XidImpl(com.swiftmq.jms.XidImpl) Request(com.swiftmq.tools.requestreply.Request) ValidationException(com.swiftmq.tools.requestreply.ValidationException) JMSException(javax.jms.JMSException) XAException(javax.transaction.xa.XAException)

Aggregations

Request (com.swiftmq.tools.requestreply.Request)35 XidImpl (com.swiftmq.jms.XidImpl)16 JMSException (javax.jms.JMSException)16 ValidationException (com.swiftmq.tools.requestreply.ValidationException)14 XAException (javax.transaction.xa.XAException)14 Dumpable (com.swiftmq.tools.dump.Dumpable)8 RequestHandler (com.swiftmq.impl.routing.single.smqpr.RequestHandler)6 StartStageRequest (com.swiftmq.impl.routing.single.smqpr.StartStageRequest)6 List (java.util.List)6 XAContextException (com.swiftmq.swiftlet.xa.XAContextException)4 ChallengeResponseFactory (com.swiftmq.auth.ChallengeResponseFactory)2 POAddObject (com.swiftmq.impl.routing.single.manager.po.POAddObject)2 ConnectReplyRequest (com.swiftmq.impl.routing.single.smqpr.v400.ConnectReplyRequest)2 ConnectReplyRequest (com.swiftmq.impl.routing.single.smqpr.v942.ConnectReplyRequest)2 MessageImpl (com.swiftmq.jms.MessageImpl)2 QueuePullTransaction (com.swiftmq.swiftlet.queue.QueuePullTransaction)2 QueueReceiver (com.swiftmq.swiftlet.queue.QueueReceiver)2 TimerListener (com.swiftmq.swiftlet.timer.event.TimerListener)2 XAContext (com.swiftmq.swiftlet.xa.XAContext)2 XidFilter (com.swiftmq.swiftlet.xa.XidFilter)2