New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Periodic task add #51
Comments
Hi Yuluo |
hi, sonus |
Thanks for the explanation, sorry! I could not follow your example, what do you mean by
Let's assume you're scheduling tasks at 30 seconds interval. IIUC, you're scheduling N tasks at Do you always delete all related tasks or only some of them? Please provide some example data with timestamp what're you doing and what're trying to achieve using Rqueue. Maybe there's an easy way to achieve the same. |
ok, i use rqueue 2.0.4 ,so I have no way to delete the tasks in redis. i think this way to realize cyclic tasks.
I use this api to accept periodic recurring tasks, it will accept a emailBean
In my processing function, I will add many tasks based on the start time, end time, and time interval
For example, a periodic task is Send email every 12 hours, from November 2020 to December 2020. so, it will add 124 task to rqueue. These tasks will have the same task id to indicate that they are the same cycle task.
When these task is executing, I sometimes need to cancel it. The task id of my assigned task will stored on the data table,When each subtask is executed, it will first query the database.If this id exists, the subtask will not be executed. in this way, I implemented a cycle task, but This method is too bad.so Is it possible to add cycle task function.Or can you tell me how to solve similar problems.If you can tell me how to implement this feature, I can also help requeue implement it. My English is not very good, please forgive me if I offend. This project is really great!!! |
Why do you think so? This is one of the easiest way to solve this problem. Other way could be you can use MessageProcessor (this can be set in |
Because it will generate a lot of subtasks,and When I need to cancel, I need to rely on a third-party database. My opinion is, If so, how can I achieve. Thank you very much! |
Interesting, this can be achieved by setting For example Task
You can use similar approach in your listener code, like as soon as your listener is invoked you enqueue a new task at next interval. But what will you do when this message is retried, we can't identify exactly if a message is being retried, one way to identify this is whenever your listener is invoked you can check |
@yuluo-zy did this make sense or you would like to have such features in Rqueue? |
I am currently working on the source code,I want to achieve it,I initially considered whether to mark it as a cyclic task by adding attributes to RqueueMessage. |
Cool, let me know if you would like to see this feature in Rqueue, we would need to find some ways accurately find failure execution messages. |
I haven't finished reading the part of the code about the exception retry,but i think,If we enqueue message as soon the task is dequeued,By judging whether id is in zset.We can add without repeating.The retry after the task fails should not be related to the re-adding of the task. |
The problem here is we don;'t store id in zset instead we store entire RqueueMessage in zset, this makes it a difficult soln. RqueueExecutor is the place to find relavant retry code. |
Hi Would you mind giving a shot, I can provide you a release candidate or snapshot. |
Thank you very much, I didn't expect you to complete it so well, again, this project is great!I can download the source code directly and use it! |
Please try and let me know, if something is breaking though I have tested using integration test. |
Thanks for the request, this feature has been added in 2.2.0 and it should be available in maven central. Open new bug for any issue etc. |
I think,
In some cases, the support of periodic tasks is required, and periodic tasks allow cancellation.
Hope to achieve this function.
Many thanks!!
The text was updated successfully, but these errors were encountered: