use of org.apache.metron.profiler.MessageRoute in project metron by apache.
the class ProfileSplitterBolt method routeMessage.
/**
* Route a message based on the Profiler configuration.
* @param input The input tuple on which to anchor.
* @param message The telemetry message.
* @param config The Profiler configuration.
* @param timestamp The timestamp of the telemetry message.
*/
private void routeMessage(Tuple input, JSONObject message, ProfilerConfig config, Long timestamp) {
// emit a tuple for each 'route'
List<MessageRoute> routes = router.route(message, config, getStellarContext());
for (MessageRoute route : routes) {
Values values = createValues(message, timestamp, route);
collector.emit(input, values);
}
LOG.debug("Found {} route(s) for message with timestamp={}", routes.size(), timestamp);
}
use of org.apache.metron.profiler.MessageRoute in project metron by apache.
the class ProfileBuilderBolt method handleMessage.
/**
* 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
flushSignal.update(timestamp);
// distribute the message
MessageRoute route = new MessageRoute(definition, entity);
messageDistributor.distribute(message, timestamp, route, getStellarContext());
LOG.debug("Message distributed: profile={}, entity={}, timestamp={}", definition.getProfile(), entity, timestamp);
}
Aggregations