Skip to content

Commit e7e6759

Browse files
committed
Add a how it works section to readme
1 parent f179ff6 commit e7e6759

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
1-
# sqlite-persistent-queue
1+
# SQLite based Persistent Queue.
2+
23
A Java Queue interface implementation that stores directly to SqliteDb
4+
5+
## How it works
6+
7+
* Implement the `QueueObjectConverter<T>` interface do decide how you want to serialize and
8+
deserialize the objects that you want to push to the Queue.
9+
10+
* The `SQLitePersistentQueue` class uses the above implementation to serialize objects before storing
11+
it the Database.
12+
13+
* Upon calling `poll()` or `remove()` on the `SQLitePersistentQueue` the item with the lowest primary
14+
key value (since the primary key is auto-incrementing) is removed from the Queue and returned. This
15+
co-incidentally is the HEAD of the queue (as queue is FIFO based).
16+
17+
* Please remember each instance of SQLitePersistentQueue creates a new connection to the Database.
18+
I have kept the freedom of how many connections to be made to DB to the developer. The ideal usage
19+
for new developers would be to hold only a single instance of the `SQLitePersistentQueue` class
20+
in your Application class, and retrieve this wherever you want. Also **DO NOT** forget to call `close()`
21+
to close the connection to the Database once you are finished using the Queue.

0 commit comments

Comments
 (0)