The application code
Now we will discuss the application code, how it uses these properties, and how custom functions can be defined for use in the SQL queries. The application comprises just a single source file, SampleApplication.java
. As discussed in Chapter 2, Getting Started with Application Development, the entry point of an Apex application is a class that implements the StreamingApplication
interface and, in particular, the populateDAG()
method of that interface. The first part of this method looks like this:
@ApplicationAnnotation(name = "ETLExample") public class SampleApplication implements StreamingApplication { @Override public void populateDAG(DAG dag, Configuration conf) { try { // without this, the application fails at launch with this error: // java.sql.SQLException: No suitable driver found for jdbc:calcite // Class.forName("org.apache.calcite.jdbc.Driver"); } catch (ClassNotFoundException e) { throw new RuntimeException(e);...