@Override public void declareBehavior(GreenRuntime runtime) { runtime.addFileServer(filePath).includeRoutesByAssoc(ROUTE_ID.ROOT); }
@Override public void declareBehavior(GreenRuntime runtime) { //in most cases the behavior need not be a local variable but we are using methods off the object //to respond to specific published topics. To do this the object is required. ProductsBehavior listener = new ProductsBehavior(runtime, maxProductId); runtime.registerListener(listener) .includeRoutes(Struct.PRODUCT_UPDATE, listener::productUpdate) .includeRoutes(Struct.ALL_PRODUCTS, listener::productAll) .includeRoutes(Struct.PRODUCT_QUERY, listener::productQuery); runtime.addResourceServer("/site","index.html").includeRoutesByAssoc(Struct.STATIC_PAGES); } }
@Override public void declareBehavior(GreenRuntime runtime) { ProductsBehavior listener = new ProductsBehavior(runtime, maxProductId, BEGIN_TOPIC, server); runtime.registerListener(listener) .includeRoutes(Struct.PRODUCT_UPDATE, listener::productUpdate) .includeRoutes(Struct.ALL_PRODUCTS, listener::productAll) .includeRoutes(Struct.PRODUCT_QUERY, listener::productQuery); int threads = 40; runtime.registerBlockingListener(new BlockingProducer(dbURL), Field.CONNECTION, threads, BEGIN_TOPIC, FINISHED_TOPIC); runtime.addPubSubListener(new RestResponder(runtime)).addSubscription(FINISHED_TOPIC); runtime.addResourceServer("/site","index.html").includeRoutesByAssoc(Struct.STATIC_PAGES); }
.includeRoutesByAssoc(Struct.RESOURCES_EXAMPLE); .includeRoutesByAssoc(Struct.FILES_EXAMPLE);