How to get today's date in BPMN timer - timer

So I need that timer in BPMN that will be type: date, but instead of putting exact date (like 2022-08-04T08:30:00) I want to get today's date and the hour that is right now. Is it possible to do it in Camunda Modeler?
Thanks.

You can use expressions in the modeler that will be executed at runtime. There exist internal context functions that might be interesting for you.
Untested, but entering this as the timer value should work:
${dateTime().plusHours(1)}
If the builtin functions are not enough for you, you could just use the value of an existing process-variable (${variableName}) and set the variable value to any date value you like (via executionListener, service task, ...).

Related

Flink drop late records even I specified the side output

I use flink to process dynamoDB stream data.
Watermark strategy: periodic, extract approximate time stamp from stream events and use it under withTimeStampAssigner.
Idleness: 10s(may not be useful at all as we only use parallism of 1.)
The data work flow looks like this:
InputStream.assignTimeStampsAndWatermarks().keyby().window(TumblingEventTimeWindow.of(1min).sideOutputLateData().reduce().map()
Then I getSideOutput(), and process the late events using exactly similar above workflow with small change such as no need to assign time stamp and watermark, no need for late output.
My logs show that all things work perfectly if ddb stream data has right timstamp, the corresponding window can close without issue and I can see the output after window is closed.
However, after I introduced late events, the late records processing logic is never triggered. I am sure that the late record’s timestamp corresponding window has closed. I put a log after I call getSideOutPut(), it never triggered. I used debugger and I am sure the getSideOutput() code is not triggered as well.
Can someone help to check this issue? Thank you.
I tried to use a different watermark strategy for late records logic. This doesn’t work as well. I want to understand why the late records are not collected to the late stream.
Without seeing more details from your implementation is difficult to give an accurate diagnosis, but based on your description, I wouldn't expect this to work:
Then I getSideOutput(), and process the late events using exactly similar above workflow with small change such as no need to assign time stamp and watermark, no need for late output.
If you are trying to apply event time windowing to the stream of late events, that's not going to work unless you adjust the allowed lateness for those windows enough to accommodate them.
As a starting point, have you tried printing the stream of late events?

How to process an already available state based on an event comes in a different stream in flink

We are working on deriving the status of accounts based on the activity on it. We calculate and keep the expiryOn date(which says the tentative, future date on which account expires) based on the user activity on the account.
We have a manual date change event which gives a date based on which the status of the account is emitted as Expired.
I would like to know on what would be the best way to achieve this.
So, my question is since the date change event occurs in future when compared to the calculation of the expiryOn date, can the broadcasted state be a solution for this? If yes, please suggest the way.
Or, is there any better approaches like Table API to solve this problem?
Broadcast state is suitable in cases (like this one) where you need to either share information or invoke actions that aren't keyed, and so cannot be sent to one relevant instance.
If you need to store the broadcast state, keep in mind that each instance will store a copy of the broadcast state on the heap, and include that copy in its checkpoints.
If you are using context.applytokeyedstate, be careful to make changes to the keyed state that are deterministic -- otherwise, in the event of a failure and recovery at a point where some instances of the broadcast operator have applied the changes to keyed state, and other instances have not, you could end up with inconsistencies.

RRDTool - Get time range

I am using RRDTool to graph Data and a predicted Trend (LSL) in one Graph.
Therefore I am adjusting the corresponding template.
At the moment I set my end time like this:
--end start+7d
When looking at the resulting graphs via the website I can select different time ranges on the right side:
Custom time Range, Overview, 4 Hours, 25 Hours, One Week, One Month and One Year
What I want:
If I select a time range of 4 Hours, 7 days of forecasting makes no sense. I want to calculate the end time dependent on the time range selected. For example I want the time period displayed in the future being exact of the same size as the time range selected.
Basically I want to define my ending time like this:
--end start+(end-start)
This is not possible, because the end time can not be defined by itself.
Is there a way to extract the selected time-range before defining the end by hand? I could calculate start+(end-start) in my PHP Template and insert it when defining the ending time.
Every help appreciated.
EDIT: I forgot to mention, that I am using RRDTool via PNP4Nagios. When speaking of a website I meant the PNP4Nagios Standard Web Appearance. This is shipped by default when installing PNP4Nagios via Packages.
With PNP4Nagios, your custom template can be used to define all the graph definition -- with the exception of the time window, which is added to the parameter lists in $opt[] and $def[]. So, you cannot easily override the time window 'end' as it is already defined as 'now' by PNP4Nagios (and the 'start' is already defined relative to the end, based on the time range you selected in the web interface). In fact, RRDTool is fairly robust, so if it sees a start/end being redefined the last such definition usually takes precedence... but this doesn't solve your issue.
I think what you're trying to do is have the 1day graph (which normally starts at 'end-1day' and ends at 'now') to go from 'now-1day' to 'now+1day' so that your prediction line could fill the second part. This would need to be done by editing the PNP4Nagios code, which is a bit out of scope of this answer.
PNP4Nagios allows definition of the standard timeranges in the config.php; you can also define new timeranges when you call the graph. This means you can achieve the required time window like this:
pnp4nagios/graph?host=<hostname>&srv=<servicedesc>&start=-1day&end=+1day
... although this is just a one-off and does not override the defaults.
The current view config in PNP4Nagios does not allow the default views to specify an end offset, only a start offset.

Apache axis: wrong date returned in Calendar object

Used Apache axis to consume a WSDL which has a column of type="xsd:dateTime".
In SOAP UI with plain vanilla request, response has -
<UpdateDateTime>2012-05-08T04:58:00</UpdateDateTime>
However when using axis consumer, for the same value - listOfValues[pos].getUpdateDateTime().getTime() returns a different time -
2012-05-07 21:58:00.
getUpdateDateTime() in the above returns instance of java.util.Calendar.
Is it a timezone problem or the 'T' in between is parsed incorrect?
How can I resolve this?
How are you displaying the "2012-05-07 21:58:00"? It's almost certainly just a time zone issue. I suspect it's treating 2012-05-08T04:58:00 as a universal time, and applying your local time zone to that. It's hard to say without seeing any code or where your diagnostics have come from, but I'd be surprised if it weren't just a time zone issue.
Of course, if you can use Joda Time instead of java.util.Date/Calendar, you can use LocalDateTime which is what I suspect is represented here (given the lack of time zone information in the response). I don't know if Axis supports that, but it would be worth looking into.
Here is the Eclipse debug with date time value in Inspect -
http://i45.tinypic.com/157zpy1.jpg
& the plain request in soap UI gives -
2012-05-08T04:58:00
Bombay,India
Sorry, i meant UTC in my first reply.

Using DateTime?.Value.TimeOfDay in LINQ Query

I'm trying to do a Query with LINQ on ASP.NET MVC 3.
I have a model, lets call it Event. This Event object has a Date property, of DateTime?. What I want is to fetch the Events that are between 2 TimeSpans.
Right now my code looks like the following:
TimeSpan From = new TimeSpan(8,0,0);
TimeSpan Until = new TimeSpan(22,0,0);
var events =
from e in db.Events
where e.Date.Value.TimeOfDay >= From,
e.Date.Value.TimeOfDay <= Until
select e;
An exception is thrown, telling me that "The specified type member 'TimeOfDay' is not supported in LINQ to Entities."
I don't get a way around this problem, and I have been all day trying. Please help me, I'm so frustrated. :(
EDIT:
I Forgot to write here the "TimeOfDay" after e.Date.Value. Anyway, I did in my code.
I can't use DateTime because I have to filter Events that occur between certain time of the day, despite the date of the event.
Use the Date and Time Canonical Functions for LINQ-to-Entities. Specifically, look at
CreateTime(hour, minute, second)
If you need help calling a canonical function, look at How To: Call Canonical Functions.

Resources