Skip to content

OpenSky monitoring

OpenSky Network is a non profit project which

[...] consists of a multitude of sensors connected to the Internet by volunteers, industrial supporters, and academic/governmental organizations. All collected raw data is archived in a large historical database. The database is primarily used by researchers from different areas to analyze and improve air traffic control technologies and processes.

-- Description from

Essentially, each airplane uses a transponder to transmit data regarding their status (squawk) as well as their callsign and current position. All this information is collected by OpenSky Network and made available though their APIs.

The underlying idea of this example is that each flight (i.e., an airplane callsign) represents the instance of a flight process. The different squawks a plane goes through indicate the activities involved in the process.

To achieve this goal, it is necessary to write a new source which periodically queries the OpenSky Network APIs to retrieve the live status of airplanes in a certain area. First it's necessary to create the actual source and initialize the OpenSkyApi wrapper:

public class OpenSkySource extends BeamlineAbstractSource {
    private OpenSkyApi api;

    public void open(Configuration parameters) throws Exception {
        Properties prop = new Properties();
        prop.load(new FileInputStream("./"));
        api = new OpenSkyApi(prop.getProperty("USERNAME"), prop.getProperty("PASSWORD"));
Please note that in this case we use the Java API (imported from JitPack) and we assume the presence of a file containing username and password for accessing the APIs.

Once the system is properly connected to the APIs, then in the run method it is possible to define a separate thread in charge of querying the APIs every 15 seconds and put the events into a buffer which is then used for dispatching them. In the case highlighted the APIs are queried to retrieve flights over the central Europe (lines 19-20). In addition the squawks are parsed to provide some more understandable interpretation (according to the interpretation reported here, the actual code of method squawkToString is omitted in this page but is available on the GitHub repository).

    public void run(SourceContext<BEvent> ctx) throws Exception {
        Queue<BEvent> buffer = new LinkedList<>();

        new Thread(() -> {
            while(isRunning()) {
                try {
                    OpenSkyStates os = api.getStates(0, null,
                        new OpenSkyApi.BoundingBox(
                            35.0518857, 62.4097744,
                            -5.8468354, 34.3186395));
                    if (os != null) {
                        for (StateVector sv : os.getStates()) {
                            try {
                                if (!sv.getCallsign().isBlank()) {
                            } catch (EventException e) {
                    } else {
                        System.out.println("No new information...");
                } catch (Exception e) {
                    // nothing to see here

        while(isRunning()) {
            while (isRunning() && buffer.isEmpty()) {
            if (isRunning()) {
                synchronized (ctx.getCheckpointLock()) {
                    BEvent e = buffer.poll();

A simple consumer, in this case the Trivial discovery miner, can then be attached to the source with:

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
   .addSource(new OpenSkySource())
   .flatMap(new DirectlyFollowsDependencyDiscoveryMiner().setModelRefreshRate(10).setMinDependency(0))
   .addSink(new SinkFunction<ProcessMap>(){
      public void invoke(ProcessMap value, Context context) throws Exception {
         value.generateDot().exportToSvg(new File("src/main/resources/output/output.svg"));

After running the system for about a few minutes, the following map was produced, where essentially only transit squawks were observed:

G eec7010c0-450a-418f-b0be-fa2d42391974->eec7010c0-450a-418f-b0be-fa2d42391974 1.0 (334) eec7010c0-450a-418f-b0be-fa2d42391974 Transit 1.0 (359)

The complete code of this example is available in the GitHub repository

Scientific literature