Search in sources :

Example 1 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_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.v610.SMQPBulkRequest) Request(com.swiftmq.tools.requestreply.Request) SMQPBulkRequest(com.swiftmq.jms.smqp.v610.SMQPBulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 2 with Dumpable

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

the class Versionable method create.

private Object create(VEntry entry) throws Exception {
    DataByteArrayInputStream dis = new DataByteArrayInputStream();
    dis.setBuffer(entry.versioned.getPayload(), 0, entry.versioned.getLength());
    Object obj = null;
    if (entry.version == -1) {
        obj = DestinationFactory.createDestination(dis);
    } else {
        DumpableFactory factory = null;
        if (classLoader == null)
            factory = (DumpableFactory) Class.forName(entry.factoryClass).newInstance();
        else
            factory = (DumpableFactory) classLoader.loadClass(entry.factoryClass).newInstance();
        Dumpable d = factory.createDumpable(dis.readInt());
        d.readContent(dis);
        obj = d;
    }
    return obj;
}
Also used : DumpableFactory(com.swiftmq.tools.dump.DumpableFactory) DataByteArrayInputStream(com.swiftmq.tools.util.DataByteArrayInputStream) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 3 with Dumpable

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

the class EndpointImpl method poll.

public void poll() {
    try {
        AMQPMessage msg = consumer.receiveNoWait(this);
        if (msg != null) {
            Data data = msg.getData().get(0);
            dis.reset();
            dis.setBuffer(data.getValue());
            Dumpable d = Dumpalizer.construct(dis, factory);
            if (d instanceof Reply)
                requestRegistry.setReply((Reply) d);
            else
                dispatch((Request) d);
            pollerService.execute(poller);
        }
    } catch (Exception e) {
        e.printStackTrace();
        close();
    }
}
Also used : Data(com.swiftmq.amqp.v100.generated.messaging.message_format.Data) AMQPMessage(com.swiftmq.amqp.v100.messaging.AMQPMessage) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 4 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_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.v750.SMQPBulkRequest) Request(com.swiftmq.tools.requestreply.Request) SMQPBulkRequest(com.swiftmq.jms.smqp.v750.SMQPBulkRequest) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 5 with Dumpable

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

the class MessageProperties method readContent.

public void readContent(DataInput in) throws IOException {
    int size = in.readInt();
    for (int i = 0; i < size; i++) {
        String name = in.readUTF();
        Dumpable d = createDumpable(in.readInt());
        d.readContent(in);
        map.put(name, d);
    }
}
Also used : 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