Copied to Clipboard
This is loaded and run on the local container at test startup:
@Container
private static final OracleContainer ORACLE = new OracleContainer(ORACLE_IMAGE)
.withStartupTimeout(Duration.ofMinutes(4))
.withUsername(TEST_USER)
.withPassword(TEST_PASSWORD);
private static OracleDataSource dataSource;
private static Path okafkaConfigDirectory;
@BeforeAll
static void configureDatabase() throws Exception {
ORACLE.copyFileToContainer(MountableFile.forClasspathResource("okafka.sql"), "/tmp/okafka.sql");
org.testcontainers.containers.Container.ExecResult result =
ORACLE.execInContainer("sqlplus", "sys / as sysdba", "@/tmp/okafka.sql");
if (result.getExitCode() != 0) {
throw new IllegalStateException("Unable to apply OKafka grants: " + result.getStderr());
}
dataSource = new OracleDataSource();
dataSource.setURL(ORACLE.getJdbcUrl());
dataSource.setUser(TEST_USER);
dataSource.setPassword(TEST_PASSWORD);
okafkaConfigDirectory = Files.createTempDirectory("okafka-tns-admin-");
Files.writeString(okafkaConfigDirectory.resolve("ojdbc.properties"), """
user = testuser
password = Welcome123#
""");
try (Connection connection = dataSource.getConnection()) {
EventSchema.createTables(connection);
}
}
Final Thoughts
Diagram titled "Package the corrections." Workflow rules and review guidance are packaged into an OKafka Java coding skill covering topics, transactions, and testing. The skill generates reusable artifacts such as topic administration, configuration properties, producer/consumer code, and integration tests. The goal is to turn recurring review comments into reusable implementation guidance.
Agent skill design for reusable OKafka coding patterns and validation workflows.
The real leverage here is developing and sharing agent skills that capture the Oracle AI Database patterns your team needs. Do you have common database workflows? Common development patterns? Encapsulate them in a skill, iterate on it, and share it.
Once details are packaged, agents can operate at a higher level. You spend less time correcting boilerplate and more time designing stronger examples, testing real behavior, and building more powerful Oracle AI Database applications from a better starting point.
To summarize
- Any Java developer working with Oracle AI Database can use this skill to write pub/sub code with Kafka APIs that target the database.
- OKafka adds database connection APIs to standard Kafka Java APIs; otherwise, the same interfaces are used.
- The getDBConnection() method in OKafka KafkaProducer and KafkaConsumer classes allows developers to add database logic to produce and consume operations in a single transaction.
- To validate generated code yourself, refer to concrete OKafka code examples.
- The skill leverages hand-written, tested OKafka code to generate new code specific to your application. You can find additional samples here.
References