aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/trygvis/async/AsyncService.java
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-05-29 22:16:50 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-05-29 22:16:50 +0200
commit7d704feb86c44fca57941d223e8605b55fcf68f0 (patch)
tree7a33458a46bcc6e211ef3e833441f80762c61a63 /src/main/java/io/trygvis/async/AsyncService.java
parentb65d39ab617d19ac48f44bc41f04a18803ca75e6 (diff)
downloadquartz-based-queue-7d704feb86c44fca57941d223e8605b55fcf68f0.tar.gz
quartz-based-queue-7d704feb86c44fca57941d223e8605b55fcf68f0.tar.bz2
quartz-based-queue-7d704feb86c44fca57941d223e8605b55fcf68f0.tar.xz
quartz-based-queue-7d704feb86c44fca57941d223e8605b55fcf68f0.zip
o Splitting out the parts that implement the "async" features vs the "queue" features.
Diffstat (limited to 'src/main/java/io/trygvis/async/AsyncService.java')
-rwxr-xr-xsrc/main/java/io/trygvis/async/AsyncService.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/io/trygvis/async/AsyncService.java b/src/main/java/io/trygvis/async/AsyncService.java
new file mode 100755
index 0000000..e90a0e4
--- /dev/null
+++ b/src/main/java/io/trygvis/async/AsyncService.java
@@ -0,0 +1,37 @@
+package io.trygvis.async;
+
+import io.trygvis.queue.Queue;
+import io.trygvis.queue.Task;
+import org.quartz.SchedulerException;
+
+import java.util.List;
+
+/**
+ * A simple framework for running tasks.
+ */
+public interface AsyncService {
+
+ /**
+ * @param name
+ * @param interval how often the queue should be polled for missed tasks in seconds.
+ * @param callable
+ * @return
+ * @throws SchedulerException
+ */
+ Queue registerQueue(String name, int interval, AsyncCallable callable) throws SchedulerException;
+
+ Queue getQueue(String name);
+
+ Task schedule(Queue queue, String... args);
+
+ Task schedule(long parent, Queue queue, String... args);
+
+ /**
+ * Polls for a new state of the execution.
+ */
+ Task update(Task ref);
+
+ interface AsyncCallable {
+ void run(List<String> arguments) throws Exception;
+ }
+}