Okra 1.6.0 Manual¶
Okra 1.6.0 Released
- Okra 1.6.0 is now available.
- For new features in Okra 1.6.0, see https://github.com/OkraScheduler/OkraSync/releases
Welcome to the Okra 1.6.0 Manual! Okra is an open-source MongoDB database migration tool.
Welcome to Okra’s documentation!¶
The main documentation for the site is organized into a couple sections:
Installation¶
To install Okra is simple:
Maven¶
<dependency>
<groupId>com.github.OkraScheduler</groupId>
<artifactId>OkraSync</artifactId>
<version>x.y.z</version>
</dependency>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Gradle¶
dependencies {
compile 'com.github.OkraScheduler:OkraSync:x.y.z'
}
repositories {
maven {
url 'https://jitpack.io'
}
}
Basic Usage¶
Prerequisites¶
Okra requires Java 8+ and Mongo Java Driver
Usage¶
- Add Okra to your project as you can see in the Installation page.
- Create a class that will store your specific job attributes
public class CheckJob extends DefaultOkraItem {
private String someAttribute;
//getters and setters
}
- Setup Okra with a MongoDB Driver
public OkraSync<CheckJob> setupOkra(MongoClient mongo): {
OkraSync<CheckJob> okra = new OkraSyncBuilder<CheckJob>()
.withMongo(mongo)
.withCollection("checkJob")
.withDatabase(mongoDatabaseName)
.withItemClass(CheckJob.class)
.withExpiration(2, TimeUnit.MINUTES)
.build();
okra.setup();
return okra;
}
- Schedule your job items
public void schedule(CheckJob item) {
okra.schedule(item);
}
- And start processing them…
public void process() {
CheckJob item = okra.peek();
if (item.isPresent()) {
// process
okra.reschedule(item)
// or okra.delete(item);
}
}
Enjoy Okra! :)
Contributing¶
Issues¶
Report issues and suggest features and improvements on the GitHub issue tracker. You may also ask questions on the issue tracker.
If you want to file a bug, please provide all the necessary info listed in our issue reporting template (it’s loaded automatically when you create a new GitHub issue).
Patches¶
Patches in any form are always welcome! GitHub pull requests are even better! :-)
Before submitting a patch or a pull request make sure all tests are passing and that your patch is in line with the contribution guidelines.