Skip to content
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

Feature Request: On Timer events add scheduling at specific time #3038

Closed
dinilv opened this issue Sep 2, 2019 · 24 comments · Fixed by #9418
Closed

Feature Request: On Timer events add scheduling at specific time #3038

dinilv opened this issue Sep 2, 2019 · 24 comments · Fixed by #9418
Labels
area/bpmn-support Marks an issue as related to supporting BPMN symbols blocker/stakeholder Marks an issue as blocked, waiting for stakeholder input kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog version:8.1.0-alpha3 Marks an issue as being completely or in parts released in 8.1.0-alpha3 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0

Comments

@dinilv
Copy link

dinilv commented Sep 2, 2019

Hi,

we are looking at automating all our user workflows using Zeebe-IO, We are a e-commerce analytics company and we are supposed to deliver reports at US time . we would like to have the capability of configuring and running the report analytic workflows at UTC 12:30 AM. Kindly consider adding timer-events on specific time as well. We use Zee-Be for repeated timer events.

@saig0 saig0 added scope/broker Marks an issue or PR to appear in the broker section of the changelog Status: Backlog kind/feature Categorizes an issue or PR as a feature, i.e. new behavior labels Sep 13, 2019
@saig0
Copy link
Member

saig0 commented Sep 13, 2019

Thank you for opening this feature request. Triggering timers at a given time is an important feature. We will implement this eventually.

In the meantime, you could implement a worker which simulates the timer for you.

In order to speed up the implementation, you can also provide a pull request. We would guide you through the implementation. Are you interested in implementing this feature?

@dinilv
Copy link
Author

dinilv commented Sep 16, 2019

Thanks. Does this implementation is in Java Capability ?

@saig0
Copy link
Member

saig0 commented Sep 16, 2019

Yes. This needs to be implemented in the broker.

@dinilv
Copy link
Author

dinilv commented Sep 16, 2019

will it be then available as part of BPMNmodeler as well ? later may be

@jasonconkey
Copy link

Hi @saig0, I'm interested in this same feature, and would possibly be interested in working on a PR. Could I please get any information you have on implementation? Also if possible, could you provide an example of how a worker would simulate the timer? Thank yo

@saig0
Copy link
Member

saig0 commented Nov 19, 2019

@jasonconkey, happy to hear that you want to contribute 👍

First of all, we should clarify what we want to build.
As far as I understand, @dinilv wants to create a new workflow instance every day at 00:30:00Z.

Proposal: time cycle with start time and duration R[n]/<start>/<duration> (see ISO 8601 Repeating Intervals)

The timer event definition of the timer start event could look like this:

  <bpmn:timerEventDefinition>
    <bpmn:timeCycle>R/2019-12-01T00:30:00Z/P1D</bpmn:timeCycle>
  </bpmn:timerEventDefinition>

Meaning: starting from 2019-12-01 at 00:30:00Z, trigger the timer every day

What do you think? Any other proposal?


Using a worker, you could pass the timer configuration via custom headers. The worker schedules a timer when a new job is polled (e.g. using Cron). When the timer is due then it completes the corresponding job.

@ceefour
Copy link
Contributor

ceefour commented Apr 19, 2020

I also need this feature :)

@saig0 R/2019-12-01T00:30:00Z/P1D yes I agree this is good syntax. BTW watch out that the timezone may contain /:

R/2019-10-02T08:09:40+02:00[Europe/Berlin]/P1D

@npepinpe npepinpe added blocker/stakeholder Marks an issue as blocked, waiting for stakeholder input and removed Status: Backlog labels May 26, 2020
@npepinpe
Copy link
Member

I think this is a duplicate of #1834 - correct me if I'm wrong @saig0 ?

@saig0
Copy link
Member

saig0 commented May 27, 2020

@npepinpe that's correct. I closed the other one.

@sergeylebed
Copy link

I also vote for this feature. We need more extended scheduler, so it should support running on certain days of a week, e.g. Monday and Wednesday? or a certain day of a Month, e.g. every 5th day. It does not seems to be covered by ISO standard but it might be worth considering.

@jwulf
Copy link
Member

jwulf commented Sep 24, 2020

I also need this feature. Camunda BPM supports cron scheduling as a syntax, which would be very flexible. Although, it would depend on the timezone of the server (I'm thinking Camunda Cloud here). You could make the broker always evaluate in UTC.

Here is a thought: if you add a FEEL function to get the current UTC time, you can put an exclusive gateway after a timer, and express the period as a condition, and loop back to a daily timer if it is not yet the right time.

@rbgigo
Copy link

rbgigo commented Sep 1, 2021

Is there any move at all with this feature request?

@inghak
Copy link

inghak commented Nov 10, 2021

Also need this. In Camunda BPM it seems to work as expected in example : R4/2016-03-11T12:13/PT5M
(https://docs.camunda.org/manual/7.6/reference/bpmn20/events/timer-events/#time-cycle).
A typical scenario would be to run each night regardless of start date, so the following should work: R/T03:00:00/P1D (repeat each night at 03:00 indefinitely, server time. Or R/T03:00:00Z/P1D (Zulu time). Or Cron support...

@lienvdsteen
Copy link

Also interested in being able to schedule daily at a specific hour. Current specific use case is to run reporting from a HR system into Slack in the morning every weekday at 8AM UTC.

@skayliu
Copy link
Contributor

skayliu commented May 5, 2022

Need Help,when I deployed a bpmn with zeebe 1.3.7 , got the an error,what's wrong?
screenshot-20220505-112555

@saig0
Copy link
Member

saig0 commented May 5, 2022

@skayliu the feature is not supported yet. The issue is still open. For now, you can specify the start time of a cycle expression.

@McAlm
Copy link

McAlm commented May 6, 2022

@felix-mueller felix-mueller added the area/bpmn-support Marks an issue as related to supporting BPMN symbols label May 11, 2022
@McAlm
Copy link

McAlm commented May 13, 2022

Hi @felix-mueller: The suggested work around is actually not working.
The feel expression is correct (returns the next 365 days at 09:00 PM)
= for x in 1..365 return date and time(today(),time("21:00:00Z")) + duration("P"+string(x)+"D")
but deployment fails:
Invalid timer cycle expression (Expected result of the expression ' for x in 1..365 return date and time(today(),time("21:00:00Z")) + duration("P"+string(x)+"D")' to be 'STRING', but was 'ARRAY'.)

@felix-mueller
Copy link
Member

@saig0 any thoughts here maybe?

@saig0
Copy link
Member

saig0 commented May 16, 2022

@McAlm please share more details about your concrete use case and how you want to use the expression.

If you want to use the expression in a timer event with a cycle definition then the expression must return a cycle expression (i.e. a string value following the pattern R/<duration>). For example:

= {
  triggerTime: time("21:00:00Z"),
  date: if time(now()) < triggerTime then today() else today() + duration("P1D"),
  duration: date and time(date, triggerTime) - now(),
  cycle: cycle(duration)
}.cycle

@McAlm
Copy link

McAlm commented May 17, 2022

Hi @saig0 : The use case is exactly as described several times above: A process needs to be started cyclic at a given time, e.g. to run an automated batch process all night at 09:00:00 PM.

Your FEEL expression does not work for this use case, it returns a value like "R/PT-0.519S", or "R/PT-54M-16.221S" which does not look like the ISO 8601 standard. Though it looks not ISO conform (at least to me) it is being interpreted by the engine in a way that every second 1..6 (!) instances are being kicked off (which is not the expected result here).

The cycle method is not documented (where does it come from?), I cannot play around with it as I don't know which params it takes.

Obviously there is no valid workaround available (except creating a scheduled worker that starts an instance in needed intervals like you mentioned above...).

@saig0
Copy link
Member

saig0 commented May 25, 2022

Your FEEL expression does not work for this use case, it returns a value like "R/PT-0.519S", or "R/PT-54M-16.221S"

Yes, the duration should not be negative 😅 It seems like a timing issue for the first case. The second case looks like an issue with the timezone.

To avoid the timing issue, we could simplify the expression and schedule the timer for the next day.

{
  tomorrow: today() + duration("P1D"),
  tomorrowAt9pm: date and time(tomorrow, time("21:00:00Z")),
  duration: tomorrowAt9pm - now(),
  cycle: cycle(duration)
}.cycle

Please check the default timezone of our environment. In SaaS, it should be UTC (i.e. Z).

The cycle method is not documented (where does it come from?), I cannot play around with it as I don't know which params it takes.

Good point. The cycle() function is currently not documented. At the moment, it is implemented in Zeebe (see here).

We may move the function to the FEEL engine and document it properly.
Or, we find a better way to describe cycle expressions. Happy to hear suggestions.

At the moment, @lzgabel is contributing a PR #9418 to support a start time for a cycle 🚀

@oleschoenburg oleschoenburg added the version:8.1.0-alpha3 Marks an issue as being completely or in parts released in 8.1.0-alpha3 label Jul 5, 2022
@Zelldon Zelldon added the version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0 label Oct 4, 2022
@Rakeshanand19
Copy link

Screenshot (1)
i need help

@saig0
Copy link
Member

saig0 commented Jan 19, 2023

@Rakeshanand19 please look at the docs on how to configure the timer event.

If you still have a problem, please open a new issue and share all relevant information (i.e. the BPMN process, the Camunda Platform version, logs, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bpmn-support Marks an issue as related to supporting BPMN symbols blocker/stakeholder Marks an issue as blocked, waiting for stakeholder input kind/feature Categorizes an issue or PR as a feature, i.e. new behavior scope/broker Marks an issue or PR to appear in the broker section of the changelog version:8.1.0-alpha3 Marks an issue as being completely or in parts released in 8.1.0-alpha3 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.