Search in sources :

Example 6 with Dumpable

use of com.swiftmq.tools.dump.Dumpable in project swiftmq-client by iitsoftware.

the class MessageProperties method writeContent.

public void writeContent(DataOutput out) throws IOException {
    out.writeInt(map.size());
    for (Map.Entry<String, Dumpable> stringDumpableEntry : map.entrySet()) {
        out.writeUTF(stringDumpableEntry.getKey());
        Dumpable d = stringDumpableEntry.getValue();
        out.writeInt(d.getDumpId());
        d.writeContent(out);
    }
}
Also used : TreeMap(java.util.TreeMap) Map(java.util.Map) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 7 with Dumpable

use of com.swiftmq.tools.dump.Dumpable in project swiftmq-client by iitsoftware.

the class StreamMessageImpl method readBody.

protected void readBody(DataInput in) throws IOException {
    nElements = in.readInt();
    if (nElements > 0) {
        elements = new Primitive[nElements];
        for (int i = 0; i < elements.length; i++) {
            Dumpable d = (Dumpable) PrimitiveFactory.createInstance(in.readInt());
            d.readContent(in);
            elements[i] = (Primitive) d;
        }
    }
}
Also used : Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 8 with Dumpable

use of com.swiftmq.tools.dump.Dumpable 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_KEEP_ALIVE_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_KEEP_ALIVE_REQ)
                    dispatch(req);
            }
        } else
            dispatch((Request) obj);
    }
}
Also used : SMQPBulkRequest(com.swiftmq.jms.smqp.v500.SMQPBulkRequest) Request(com.swiftmq.tools.requestreply.Request) SMQPBulkRequest(com.swiftmq.jms.smqp.v500.SMQPBulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 9 with Dumpable

use of com.swiftmq.tools.dump.Dumpable 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_KEEP_ALIVE_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_KEEP_ALIVE_REQ)
                    dispatch(req);
            }
        } else
            dispatch((Request) obj);
    }
}
Also used : SMQPBulkRequest(com.swiftmq.jms.smqp.v400.SMQPBulkRequest) Request(com.swiftmq.tools.requestreply.Request) SMQPBulkRequest(com.swiftmq.jms.smqp.v400.SMQPBulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 10 with Dumpable

use of com.swiftmq.tools.dump.Dumpable 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;
        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) SMQPBulkRequest(com.swiftmq.jms.smqp.v600.SMQPBulkRequest) Reply(com.swiftmq.tools.requestreply.Reply) IOException(java.io.IOException) Dumpable(com.swiftmq.tools.dump.Dumpable)

Aggregations

Dumpable (com.swiftmq.tools.dump.Dumpable)23 Request (com.swiftmq.tools.requestreply.Request)8 IOException (java.io.IOException)6 Reply (com.swiftmq.tools.requestreply.Reply)4 LengthCaptureDataInput (com.swiftmq.tools.util.LengthCaptureDataInput)3 DataInput (java.io.DataInput)3 JMSSecurityException (javax.jms.JMSSecurityException)3 Endpoint (com.swiftmq.admin.mgmt.Endpoint)2 Data (com.swiftmq.amqp.v100.generated.messaging.message_format.Data)2 AMQPMessage (com.swiftmq.amqp.v100.messaging.AMQPMessage)2 BytesMessageImpl (com.swiftmq.jms.BytesMessageImpl)2 InvalidVersionException (com.swiftmq.jms.InvalidVersionException)2 SMQPBulkRequest (com.swiftmq.jms.smqp.v600.SMQPBulkRequest)2 SMQPBulkRequest (com.swiftmq.jms.smqp.v610.SMQPBulkRequest)2 SMQPBulkRequest (com.swiftmq.jms.smqp.v630.SMQPBulkRequest)2 SMQPBulkRequest (com.swiftmq.jms.smqp.v750.SMQPBulkRequest)2 BulkRequest (com.swiftmq.impl.routing.single.smqpr.BulkRequest)1 SMQPBulkRequest (com.swiftmq.jms.smqp.v400.SMQPBulkRequest)1 SMQPBulkRequest (com.swiftmq.jms.smqp.v500.SMQPBulkRequest)1 SMQPBulkRequest (com.swiftmq.jms.smqp.v510.SMQPBulkRequest)1