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();
}
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;
}
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();
}
}
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();
}
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);
}
}
Aggregations