Search in sources :

Example 1 with ConnectReplyRequest

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");
}
Also used : ConnectRequest(com.swiftmq.impl.routing.single.smqpr.v942.ConnectRequest) ConnectReplyRequest(com.swiftmq.impl.routing.single.smqpr.v942.ConnectReplyRequest) RequestHandler(com.swiftmq.impl.routing.single.smqpr.RequestHandler) StartStageRequest(com.swiftmq.impl.routing.single.smqpr.StartStageRequest) StartStageRequest(com.swiftmq.impl.routing.single.smqpr.StartStageRequest) ConnectRequest(com.swiftmq.impl.routing.single.smqpr.v942.ConnectRequest) Request(com.swiftmq.tools.requestreply.Request) ConnectReplyRequest(com.swiftmq.impl.routing.single.smqpr.v942.ConnectReplyRequest) POAddObject(com.swiftmq.impl.routing.single.manager.po.POAddObject)

Example 2 with ConnectReplyRequest

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");
}
Also used : ConnectRequest(com.swiftmq.impl.routing.single.smqpr.v400.ConnectRequest) ConnectReplyRequest(com.swiftmq.impl.routing.single.smqpr.v400.ConnectReplyRequest) RequestHandler(com.swiftmq.impl.routing.single.smqpr.RequestHandler) StartStageRequest(com.swiftmq.impl.routing.single.smqpr.StartStageRequest) StartStageRequest(com.swiftmq.impl.routing.single.smqpr.StartStageRequest) ConnectRequest(com.swiftmq.impl.routing.single.smqpr.v400.ConnectRequest) Request(com.swiftmq.tools.requestreply.Request) ConnectReplyRequest(com.swiftmq.impl.routing.single.smqpr.v400.ConnectReplyRequest) POAddObject(com.swiftmq.impl.routing.single.manager.po.POAddObject)

Aggregations

POAddObject (com.swiftmq.impl.routing.single.manager.po.POAddObject)2 RequestHandler (com.swiftmq.impl.routing.single.smqpr.RequestHandler)2 StartStageRequest (com.swiftmq.impl.routing.single.smqpr.StartStageRequest)2 Request (com.swiftmq.tools.requestreply.Request)2 ConnectReplyRequest (com.swiftmq.impl.routing.single.smqpr.v400.ConnectReplyRequest)1 ConnectRequest (com.swiftmq.impl.routing.single.smqpr.v400.ConnectRequest)1 ConnectReplyRequest (com.swiftmq.impl.routing.single.smqpr.v942.ConnectReplyRequest)1 ConnectRequest (com.swiftmq.impl.routing.single.smqpr.v942.ConnectRequest)1