use of edu.snu.mist.client.APIQueryControlResult in project mist by snuspl.
the class MqttFilterApplication method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).registerShortNameOfClass(// Additional parameter
NettySourceAddress.class).registerShortNameOfClass(MqttSourceTopic.class).registerShortNameOfClass(MqttSinkTopic.class).registerShortNameOfClass(FilteredString.class).registerShortNameOfClass(ApplicationIdentifier.class).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
final APIQueryControlResult result = submitQuery(jcb.build());
System.out.println("Query submission result: " + result.getQueryId());
}
use of edu.snu.mist.client.APIQueryControlResult in project mist by snuspl.
the class QueryDeletion method submitQuery.
/**
* Submit a query containing reduce-by-key operator.
* The query reads strings from a source server, filters alphabetical words,
* counts words using reduce-by-key operator, and sends them to a sink server.
* @return result of the submission
* @throws IOException
* @throws InjectionException
*/
public static APIQueryControlResult submitQuery(final Configuration configuration) throws IOException, InjectionException, URISyntaxException {
final String sourceSocket = Tang.Factory.getTang().newInjector(configuration).getNamedInstance(NettySourceAddress.class);
final SourceConfiguration localTextSocketSourceConf = MISTExampleUtils.getLocalTextSocketSourceConf(sourceSocket);
// Simple reduce function.
final MISTBiFunction<Integer, Integer, Integer> reduceFunction = (v1, v2) -> {
return v1 + v2;
};
final MISTQueryBuilder queryBuilder = new MISTQueryBuilder();
queryBuilder.socketTextStream(localTextSocketSourceConf).filter(s -> isAlpha(s)).map(s -> new Tuple2(s, 1)).reduceByKey(0, String.class, reduceFunction).map(s -> s.toString()).textSocketOutput(MISTExampleUtils.SINK_HOSTNAME, MISTExampleUtils.SINK_PORT);
return MISTExampleUtils.submit(queryBuilder, configuration);
}
use of edu.snu.mist.client.APIQueryControlResult in project mist by snuspl.
the class RuleBasedHelloMist method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).registerShortNameOfClass(// Additional parameter
NettySourceAddress.class).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer());
sinkServer.start();
final APIQueryControlResult result = submitQuery(jcb.build());
System.out.println("Query submission result: " + result.getQueryId());
}
use of edu.snu.mist.client.APIQueryControlResult in project mist by snuspl.
the class RuleBasedMQTTHelloMist method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).registerShortNameOfClass(// Additional parameter
NettySourceAddress.class).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer());
sinkServer.start();
final APIQueryControlResult result = submitQuery(jcb.build());
System.out.println("Query submission result: " + result.getQueryId());
}
use of edu.snu.mist.client.APIQueryControlResult in project mist by snuspl.
the class RuleBasedMQTTNoiseSensing method main.
/**
* Set the environment(Hostname and port of driver, source, and sink) and submit a query.
* @param args command line parameters
* @throws Exception
*/
public static void main(final String[] args) throws Exception {
final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder();
final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb).processCommandLine(args);
if (commandLine == null) {
// Option '?' was entered and processCommandLine printed the help.
return;
}
Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer());
sinkServer.start();
final APIQueryControlResult result = submitQuery(jcb.build());
System.out.println("Query submission result: " + result.getQueryId());
}
Aggregations