use of com.swiftmq.impl.routing.single.smqpr.v400.ConnectReplyRequest in project swiftmq-ce by iitsoftware.
the class ConnectStage method init.
protected void init() {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/init...");
visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.SMQRFactory.START_STAGE_REQ, new RequestHandler() {
public void visited(Request request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + "...");
ConnectRequest cr = new ConnectRequest(ctx.routerName, routingConnection.isXa());
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + ", sending request= " + cr);
routingConnection.getOutboundQueue().enqueue(cr);
startValidTimer();
}
});
visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.CONNECT_REPREQ, new RequestHandler() {
public void visited(Request request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + "...");
ConnectReplyRequest reply = (ConnectReplyRequest) request;
if (reply.isOk()) {
routingConnection.setRouterName(reply.getRouterName());
ctx.connectionManager.enqueue(new POAddObject(new ConnectorCallback(reply), null, routingConnection));
} else {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + ", disconnect");
ctx.networkSwiftlet.getConnectionManager().removeConnection(routingConnection.getConnection());
}
}
});
visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.CONNECT_REQ, new RequestHandler() {
public void visited(Request request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request);
ConnectRequest pr = (ConnectRequest) request;
routingConnection.setRouterName(pr.getRouterName());
ctx.connectionManager.enqueue(new POAddObject(new ListenerCallback(pr), null, routingConnection));
}
});
if (!listener)
getStageQueue().enqueue(new StartStageRequest());
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/init done");
}
use of com.swiftmq.impl.routing.single.smqpr.v400.ConnectReplyRequest in project swiftmq-ce by iitsoftware.
the class ConnectStage method init.
protected void init() {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/init...");
visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.SMQRFactory.START_STAGE_REQ, new RequestHandler() {
public void visited(Request request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + "...");
ConnectRequest cr = new ConnectRequest(ctx.routerName);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + ", sending request= " + cr);
routingConnection.getOutboundQueue().enqueue(cr);
startValidTimer();
}
});
visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v400.SMQRFactory.CONNECT_REPREQ, new RequestHandler() {
public void visited(Request request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + "...");
ConnectReplyRequest reply = (ConnectReplyRequest) request;
if (reply.isOk()) {
routingConnection.setRouterName(reply.getRouterName());
ctx.connectionManager.enqueue(new POAddObject(new ConnectorCallback(reply), null, routingConnection));
} else {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request + ", disconnect");
ctx.networkSwiftlet.getConnectionManager().removeConnection(routingConnection.getConnection());
}
}
});
visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v400.SMQRFactory.CONNECT_REQ, new RequestHandler() {
public void visited(Request request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), ConnectStage.this.toString() + "/visited, request=" + request);
ConnectRequest pr = (ConnectRequest) request;
routingConnection.setRouterName(pr.getRouterName());
ctx.connectionManager.enqueue(new POAddObject(new ListenerCallback(pr), null, routingConnection));
}
});
if (!listener)
getStageQueue().enqueue(new StartStageRequest());
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/init done");
}
Aggregations