use of com.swiftmq.amqp.v100.generated.transport.definitions.TransferNumber in project swiftmq-client by iitsoftware.
the class SessionDispatcher method visit.
public void visit(POFillCache po) {
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " ...");
Consumer c = po.getConsumer();
FlowFrame flowFrame = new FlowFrame(mySession.getChannel());
flowFrame.setHandle(new Handle(c.getHandle()));
flowFrame.setAvailable(new AMQPUnsignedInt(0));
flowFrame.setDrain(AMQPBoolean.FALSE);
flowFrame.setNextIncomingId(new TransferNumber(nextIncomingId));
flowFrame.setNextOutgoingId(new TransferNumber(nextOutgoingId));
flowFrame.setLinkCredit(new AMQPUnsignedInt(po.getLinkCredit()));
flowFrame.setIncomingWindow(new AMQPUnsignedInt(incomingWindow));
flowFrame.setOutgoingWindow(new AMQPUnsignedInt(outgoingWindow));
if (po.getLastDeliveryId() != -1)
flowFrame.setDeliveryCount(new SequenceNo(po.getLastDeliveryId()));
TxnIdIF txnIdIF = po.getTxnIdIF();
if (txnIdIF != null) {
Map map = new HashMap();
map.put(new AMQPSymbol("txn-id"), txnIdIF);
try {
flowFrame.setProperties(new Fields(map));
} catch (IOException e) {
e.printStackTrace();
}
}
outboundHandler.send(flowFrame);
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " done");
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.TransferNumber in project swiftmq-client by iitsoftware.
the class FlowFrame method decode.
private void decode() throws Exception {
List l = body.getValue();
AMQPType t = null;
int idx = 0;
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
nextIncomingId = new TransferNumber(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'nextIncomingId' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'incomingWindow' in 'Flow' frame is NULL");
try {
incomingWindow = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'incomingWindow' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'nextOutgoingId' in 'Flow' frame is NULL");
try {
nextOutgoingId = new TransferNumber(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'nextOutgoingId' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'outgoingWindow' in 'Flow' frame is NULL");
try {
outgoingWindow = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'outgoingWindow' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
handle = new Handle(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'handle' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
deliveryCount = new SequenceNo(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'deliveryCount' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
linkCredit = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'linkCredit' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
available = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'available' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
drain = (AMQPBoolean) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'drain' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
echo = (AMQPBoolean) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'echo' in 'Flow' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
properties = new Fields(((AMQPMap) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'properties' in 'Flow' frame: " + e);
}
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.TransferNumber in project swiftmq-client by iitsoftware.
the class BeginFrame method decode.
private void decode() throws Exception {
List l = body.getValue();
AMQPType t = null;
int idx = 0;
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
remoteChannel = (AMQPUnsignedShort) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'remoteChannel' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'nextOutgoingId' in 'Begin' frame is NULL");
try {
nextOutgoingId = new TransferNumber(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'nextOutgoingId' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'incomingWindow' in 'Begin' frame is NULL");
try {
incomingWindow = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'incomingWindow' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'outgoingWindow' in 'Begin' frame is NULL");
try {
outgoingWindow = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'outgoingWindow' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
handleMax = new Handle(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'handleMax' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
offeredCapabilities = AMQPTypeDecoder.isArray(t.getCode()) ? (AMQPArray) t : singleToArray(t);
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'offeredCapabilities' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
desiredCapabilities = AMQPTypeDecoder.isArray(t.getCode()) ? (AMQPArray) t : singleToArray(t);
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'desiredCapabilities' in 'Begin' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
properties = new Fields(((AMQPMap) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'properties' in 'Begin' frame: " + e);
}
}
Aggregations