Skip to content

Commit

Permalink
updating with scheduling, only working in intellij, think the thread …
Browse files Browse the repository at this point in the history
…isn't getting hit with the println of the feed... might try another.
  • Loading branch information
xicubed committed Sep 19, 2013
1 parent 33df706 commit 6c1b652
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ e.g.

user=> (ariane.core/parse "http://your-rss-feed-here.com/feed/")

OR now added

lein run

## License

Original Copyright © 2013 Eric Prunier
Expand Down
54 changes: 54 additions & 0 deletions ariane.iml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,60 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/clojurewerkz/quartzite/1.1.0/quartzite-1.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/quartz-scheduler/quartz/2.1.7/quartz-2.1.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/c3p0/c3p0/0.9.1.1/c3p0-0.9.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="file://$MAVEN_REPOSITORY$/org/slf4j/slf4j-parent/1.6.1" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-nop/1.6.4/slf4j-nop-1.6.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>

2 changes: 1 addition & 1 deletion lastrun.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Wed, 18 Sep 2013 21:15:44 +0000
Thu, 19 Sep 2013 16:34:48 +0000
4 changes: 3 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
[org.clojure/data.zip "0.1.1"]
[clj-http "0.7.6"]
[clj-time "0.6.0"]
[overtone/at-at "1.2.0"]])
[overtone/at-at "1.2.0"]
[clojurewerkz/quartzite "1.1.0"]]
:main ariane.sched)
14 changes: 8 additions & 6 deletions src/ariane/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[ariane.atom :as atom]
[clj-time.core :as ct]
[clj-time.format :as ctf]
[overtone.at-at :as ot]))
[overtone.at-at :as ot]
[clojurewerkz.quartzite.scheduler :as qs]))


; scheduling
Expand Down Expand Up @@ -44,9 +45,10 @@
:else (println "Unsupported format")))
)

(defn runme
[]
(println (parse my-url)))
;(do (parse my-url)))
;(defn runme
; []
; (println (parse my-url)))
; ;(do (parse my-url)))
;
;(ot/every 360000 runme my-pool :desc "polls periodically" :initial-delay 10000)

(ot/every 360000 runme my-pool :desc "polls periodically" :initial-delay 10000)
7 changes: 0 additions & 7 deletions src/ariane/rss.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
[clj-time.format :as ctf]
))








(def lastrun (atom (slurp "lastrun.txt") ))

(defn updatedate
Expand Down
35 changes: 35 additions & 0 deletions src/ariane/sched.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(ns ariane.sched

(:require [ariane.core :as ac]
[clojurewerkz.quartzite.scheduler :as qs]
[clojurewerkz.quartzite.triggers :as t]
[clojurewerkz.quartzite.jobs :as j]
[clojurewerkz.quartzite.jobs :refer [defjob]]
[clojurewerkz.quartzite.schedule.daily-interval :refer [schedule monday-through-friday starting-daily-at time-of-day ending-daily-at with-interval-in-minutes]]))

(defrecord NoOpJob []
org.quartz.Job
(execute [this ctx]
(println (ac/parse "http://news.boisestate.edu/update/feed/"))
))

(defn -main
[& m]
(qs/initialize)
(qs/start)
(when (qs/started?)
(println "The scheduler is running."))
(let [job (j/build
(j/of-type NoOpJob)
(j/with-identity (j/key "jobs.noop.1")))
trigger (t/build
(t/with-identity (t/key "triggers.1"))
(t/start-now)
(t/with-schedule (schedule
(with-interval-in-minutes 15)
(monday-through-friday)
(starting-daily-at (time-of-day 8 00 00))
(ending-daily-at (time-of-day 18 00 00)))))]
(qs/schedule job trigger)))


0 comments on commit 6c1b652

Please sign in to comment.