Search in sources :

Example 1 with GreenCommandChannel

use of com.ociweb.gl.api.GreenCommandChannel in project GreenLightning by oci-pronghorn.

the class AllRoutesExample2 method declareBehavior.

@Override
public void declareBehavior(GreenRuntime runtime) {
    final GreenCommandChannel cmd = runtime.newCommandChannel(NET_RESPONDER);
    RestListener listener = new RestListener() {

        @Override
        public boolean restRequest(HTTPRequestReader request) {
            // TODO: this route is the wrong value
            int id = request.getRouteId();
            System.out.println(id);
            return cmd.publishHTTPResponse(request, 200);
        }
    };
    runtime.addRestListener(listener).includeAllRoutes();
}
Also used : RestListener(com.ociweb.gl.api.RestListener) HTTPRequestReader(com.ociweb.gl.api.HTTPRequestReader) GreenCommandChannel(com.ociweb.gl.api.GreenCommandChannel)

Aggregations

GreenCommandChannel (com.ociweb.gl.api.GreenCommandChannel)1 HTTPRequestReader (com.ociweb.gl.api.HTTPRequestReader)1 RestListener (com.ociweb.gl.api.RestListener)1