Comments (5)
This would also provide access to Client#removeDelayedEnqueue() for when we need to cancel a scheduled job. In the current grails implemenation, I don't see a way to destroy or remove a scheduled job.
net.greghaines.jesque.client.Client#removeDelayedEnqueue
net.greghaines.jesque.client.Client#delayedEnqueue
from grails-jesque.
I just got around to testing it, and there was no problem using the underlying jesque client for delayedEnqueue and removeDelayedEnqueue.
My test job executed at the correct time.
I was also able to delete a delayed test job correctly.
Using:
compile "org.grails.plugins:jesque:1.2.1"
grails 3.1.16
Here's examples using the jesque client syntax:
jesqueService.jesqueClient.delayedEnqueue("myqueue",
new Job(MyJesqueJob.simpleName, [user.id, myOtherArg]), myScheduledDateTime.getMillis()
)
jesqueService.jesqueClient.removeDelayedEnqueue("myqueue",
new Job(MyJesqueJob.simpleName, [user.id, myOtherArg])
)
So, it appears that it would be straight forward to use the jesque client in the next release.
from grails-jesque.
Actually, it would also require the grails plugin to integrate the 2.1.1 jesque project implementation of WorkerImpl.pop(), which uses a lua script to ensure that only a single worker runs a delayed and/or scheduled task. Otherwise, user is exposed to a pre jesque 2.1.1 bug where multiple workers execute a single delayed or recurring task. (This can be a disaster if the task is not explicitly, defensively coded to protect against this case. I've had to implement custom locking logic to ensure this in my app.)
gresrun/jesque#91
In the meantime, the current grails plugin doesn't support removing delayed tasks, which can be a deal breaker for many apps, and is natively supported in jesque.
from grails-jesque.
fyi, I confirmed that v1.2.1 grails plugin version of recurring jobs does not suffer from the multiple workers concurrently executing the recurring job jesque bug, even in a distributed environment. (Very good!)
i.e. Only one worker thread on one server executes the job at each recurring interval.
from grails-jesque.
I just worked on this a bit. See #27
Actually the jesque delayed job feature works a bit differently:
A delayed queue can not be used as a regular queue and vice versa.
Workers have to be configured to also poll delayed queues.
The workers pop method can handle both regular and delayed queues.
I managed to keep the plugins old behaviour by transparently handling of the jesque delayed queues.
This means that using the same queue name for enqueue
and enqueueAt
will still work.
Input welcome!
from grails-jesque.
Related Issues (18)
- Changelog file HOT 1
- Demo project fails when using recent versions of this plugin HOT 9
- Support Job with named vars., not just unnamed args. HOT 1
- Create a release for a critical bug fixed in issue 16, December 2016 HOT 2
- Validate classes in jobTypes exist HOT 2
- [ERROR] WorkerImpl Could not close Jedis connection on server restart HOT 5
- Improve instructions for jesque Cron Jobs
- Slf4j logging does not work in recurring jobs HOT 3
- Recurring job simple format throws Invalid Format exception
- programmatically scheduling a recurring task silently fails HOT 1
- JesqueDelayedJobThreadService throws IllegalFieldValueException HOT 1
- scheduled job enqueued twice
- No errors are shown when startup fails
- Transfer to https://github.com/gpc HOT 1
- hibernate session is not closed if flush fails
- jobs with parameters are not "registered"
- pooled resource is not being returned to pool
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grails-jesque.