Code corresponding to the egress bridges cookbook.
Read this in other languages: 简体中文
Recall the two designs of push-type egress bridges to non-Swim sinks:
-
A singleton Web Agent writes to the sink through a non-blocking driver
-
Any Web Agent writes to the sink through a thread-safe, non-blocking driver
Our sink in this example is a relational H2 database. Oracle has an Asynchronous Database Acesss (ADBA) API, of which ADBA over JDBC implements a subset. Everything in the com.oracle.adbaoverjdbc
package in this repository has been pulled straight from there; the only modifications were to make the directory structures match what Gradle expects.
We scrape together the working pieces to create our non-blocking CustomDriver
. In order to keep the implementation simple, CustomDriver
is not thread-safe. We therefore only demonstrate Option 2 in this example.
This demo requires running the swim.grade.db.Database
, swim.grade.GradePlane
, and swim.grade.Sim
classes in that order. Review README.md
from the parent directory for instructions on how to do this. For those who pick Option 2, the gradle
task corresponding to swim.grade.db.Database
is called runDb
, and the one corresponding to swim.grade.Sim
is called runSim
.
Close aforementioned three processes in the opposite order to which they were run. Immediately before GradePlane
exits, the process issues a read of each student in the database; you should confirm that these match the final log for each StudentAgent
.