/** * Apply a message to a set of profiles. * @param message The message to apply. */ public void apply(JSONObject message) { // route the message to the correct profile builders List<MessageRoute> routes = router.route(message, config, context); for (MessageRoute route : routes) { distributor.distribute(route, context); } routeCount += routes.size(); messageCount += 1; }
distributor.distribute(route, context);
/** * Handles the processing of a single tuple. * * @param input The tuple containing a telemetry message. */ private void handleMessage(Tuple input) { // crack open the tuple JSONObject message = getField(MESSAGE_TUPLE_FIELD, input, JSONObject.class); ProfileConfig definition = getField(PROFILE_TUPLE_FIELD, input, ProfileConfig.class); String entity = getField(ENTITY_TUPLE_FIELD, input, String.class); Long timestamp = getField(TIMESTAMP_TUPLE_FIELD, input, Long.class); // keep track of time activeFlushSignal.update(timestamp); // distribute the message MessageRoute route = new MessageRoute(definition, entity, message, timestamp); synchronized (messageDistributor) { messageDistributor.distribute(route, getStellarContext()); } LOG.debug("Message distributed: profile={}, entity={}, timestamp={}", definition.getProfile(), entity, timestamp); }