@Override public void declareBehavior(GreenRuntime runtime) { runtime.addStartupListener(new KickoffBehavior(runtime, target)); runtime.addPubSubListener(new GenerateBehavior(runtime, "Count", target, seed)) .addSubscription("Next"); CountBehavior counter = new CountBehavior(runtime, "Next"); runtime.registerListener(counter) .addSubscription("Count", counter::triggerNextAndCount) .addSubscription("AnExample", counter::anotherMessage); }
public void declareParallelBehavior(GreenRuntime runtime) { final int track = trackId++; //System.out.println("declare track: "+track); TrackHTTPResponseListener responder = new TrackHTTPResponseListener(runtime, track); runtime.registerListener(RESPONDER_NAME, responder) .addSubscription(CALL_TOPIC, responder::callMessage) .acceptHostResponses(session[track]); }
@Override public void declareBehavior(GreenRuntime runtime) { HTTPGetBehaviorSingle temp = new HTTPGetBehaviorSingle(runtime, session1); runtime.addResponseListener(new HTTPResponse(console)).acceptHostResponses(session2); runtime.addStartupListener(new HTTPGetBehaviorChained(runtime, session2)); runtime.addStartupListener("startupBehavior",temp) .acceptHostResponses(session1) //this line is required to use JSON extraction even to self behavior as consumer .addSubscription("next"); runtime.addPubSubListener("shutdownBehavior",new ShutdownBehavior(runtime)).addSubscription("shutdown"); }
.addSubscription(internalIngressTopic, mqttBrokerListener::receiveMqttMessage); .addSubscription(localTestTopic, doTheBusiness::receiveTestTopic);
@Override public void declareBehavior(GreenRuntime runtime) { runtime.addRestListener(new ExternalRequest(runtime, session, "/service", HANDOFF_TOPIC)) .includeRoutesByAssoc(Struct.PROXY_ROUTE); runtime.addPubSubListener(new ExternalResponse(runtime)) .acceptHostResponses(session) .addSubscription(HANDOFF_TOPIC); runtime.addRestListener(new InternalService(runtime)) .includeRoutesByAssoc(Struct.SERIVCE_ROUTE); }
.addSubscription(topicToBlockingTask); ((ReactiveListenerStage)balanceWork).addOutputPronghornPipes(toBlockingWork);
@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); }
registerListener.addSubscription(internalTopicsXmit[i]);