use of com.swiftmq.amqp.v100.generated.transport.definitions.Milliseconds in project swiftmq-client by iitsoftware.
the class OpenFrame 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++);
if (t.getCode() == AMQPTypeDecoder.NULL)
throw new Exception("Mandatory field 'containerId' in 'Open' frame is NULL");
try {
containerId = (AMQPString) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'containerId' in 'Open' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
hostname = (AMQPString) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'hostname' in 'Open' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
maxFrameSize = (AMQPUnsignedInt) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'maxFrameSize' in 'Open' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
channelMax = (AMQPUnsignedShort) t;
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'channelMax' in 'Open' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
idleTimeOut = new Milliseconds(((AMQPUnsignedInt) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'idleTimeOut' in 'Open' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
outgoingLocales = AMQPTypeDecoder.isArray(t.getCode()) ? (AMQPArray) t : singleToArray(t);
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'outgoingLocales' in 'Open' frame: " + e);
}
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
incomingLocales = AMQPTypeDecoder.isArray(t.getCode()) ? (AMQPArray) t : singleToArray(t);
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'incomingLocales' in 'Open' 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 'Open' 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 'Open' 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 'Open' frame: " + e);
}
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.Milliseconds in project swiftmq-client by iitsoftware.
the class ConnectionDispatcher method visit.
public void visit(POOpen po) {
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " ...");
openPO = po;
try {
OpenFrame openFrame = new OpenFrame(0);
openFrame.setContainerId(new AMQPString(po.getContainerId()));
openFrame.setChannelMax(new AMQPUnsignedShort(po.getMaxChannel()));
if (myConnection.getOpenHostname() == null)
openFrame.setHostname(new AMQPString(remoteHostname));
else
openFrame.setHostname(new AMQPString(myConnection.getOpenHostname()));
maxLocalFrameSize = po.getMaxFrameSize() > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) po.getMaxFrameSize();
openFrame.setMaxFrameSize(new AMQPUnsignedInt(maxLocalFrameSize));
myIdleTimeout = po.getIdleTimeout();
if (myIdleTimeout > 0) {
openFrame.setIdleTimeOut(new Milliseconds(myIdleTimeout));
idleTimeoutDelay = po.getIdleTimeout() / 2;
idleTimeoutChecker = new TimerListener() {
public void performTimeAction(TimerEvent evt) {
dispatch(new POCheckIdleTimeout(null));
}
};
TimerRegistry.Singleton().addTimerListener(idleTimeoutDelay, idleTimeoutChecker);
}
outboundHandler.send(openFrame);
} catch (Exception e) {
e.printStackTrace();
}
checkBothSidesOpen();
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " done");
}
Aggregations