Storage

At the moment Doddle only supports Postgres to store jobs, however, this will change in the future when other storage providers are added.

Relational databases

Doddle uses MyBatis for interacting with relational databases.

To get started, install the SQL storage dependency

<dependency>
     <groupId>dev.doddle</groupId>
     <artifactId>sql-storage</artifactId>
     <version>${doddle.version}</version>
</dependency>

Postgres

Provide the PostgreSQL dependency

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>${postgres.version}</version>
</dependency>

Create the storage provider

The data source is an implementation of the javax.sql.Datasource interface.

import dev.doddle.storage.common.StorageProvider;
import dev.doddle.storage.sql.PostgresStorageProvider;

final StorageProvider storageProvider = new PostgresStorageProvider(dataSource);

Creating a simple datasource (just for demo purposes)

 final PGSimpleDataSource ds = new PGSimpleDataSource();
 ds.setServerNames(new String[]{"localhost"});
 ds.setDatabaseName("postgres");
 ds.setUser("postgres");
 ds.setPassword("postgres");
 return ds;

Populate the database

TODO - explain here

Now let's configure Doddle to use this storage provider!

Last updated