Re: [rules-users] Fusion, Insert Events with timestamp in the past.
I realized that there are some mistakes in my previous post with the times: 1. First example: LHS: $e: Message (Message(this after [0, 10sec] $e), where Message has an @timestamp 1.1. insert(new Message(NOW().subtract(5sec))); -- 11:00:00am wait(6sec); insert(new Message(NOW())); // NOT Activated 1.2. insert(new Message(NOW().subtract(5sec))); -- 11:00:00am wait(2sec); insert(new Message(NOW())); // Activated at 11:00:05am 2. First example: LHS: $e: Message not (Message(this after [0, 10sec] $e), where Message has an @timestamp insert(new Message(NOW().subtract(5sec))); -- 11:00:00am // Activated at 11:00:10am Has anybody an idea with example #2 is not working? -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4030069.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Fusion, Insert Events with timestamp in the past.
Hi, I am working on an existing drools project. We have a lot of rules with after or not after relationships. One of the problems I run into is when updating the rules. At the moment a new session will be created and all facts are inserted from the old to the new session. But something does not work in the scenario. To reproduce the problem I made a simple test with the following rule: rule not after when $message : DroolsSimulationMessage(value == 1) not (DroolsSimulationMessage(value == 2, this after [1s, 10s] $message)) then end I inserted an event with a timestamp 5 seconds in the past and I expect the rule to be activated 5 seconds after the event was inserted. But in my scenario it does not work, the rule is activated after 10 seconds. This is a very important point to make the current update progress work. Should it work and if not is there a better way to realize rule-updates? Thanks you in advance, Sebastian -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion, Insert Events with timestamp in the past.
I have forgotten to mention that the drools version is 5.5.0.Final, the test is running in stream mode with a realtime clock. -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029844.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion, Insert Events with timestamp in the past.
I see that the update process is not optimal, but can you tell me if my simple example should work or not? We get measurements from sensors. Because of network delay and other intermediate processes the timestamp of the measurements can be some seconds behind the time of the insert. In this case the rules with after would not work correctly as well. I am new to drools, so there is a high chance that I make some mistakes. -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029847.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion, Insert Events with timestamp in the past.
Thanks for your answer. We already use the pseudo-clock for running unit tests, but there might be some other problems: 1. If you do not move forward step by step you can miss the exact times when using negative patterns. e.g. in my example you would need to step forward with AdvanceTiem with about 100ms or 1sec or so. 2. We also use timers, this does not work with the pseudo clock as well, same problem like above. In my understand the example should work, if not I dont see what the @timestamp config is for. -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029852.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion, Insert Events with timestamp in the past.
We made another test with the pseudclock where we advanced the time after each measurement. Lets say we have the two measurements, the first at 10am and the second at 11am. Based on the rule before, you would expect that the rule fires at 10:10am because no other event is inserted. But what happens was that the rule is activated at 11am, because the clock has not been advanced in the meantime. This makes totally sense for me, so I thought you might need another thread or so. If you implement it like this (pseudo-code), it works fine: session.insert(first); clock.advanceTime(first.getTime()); while (time second.getTime()) { clock.advanceTime(100); time.add(100ms); } session.insert(second); clock.advanceTime(second.getTime()); What makes our scenario very complicated is that we mix realtime and pseudo-time a little bit. For example we have timers that trigger at midnight or so (in realtime) and we have measurmenets with a delay of some seconds, where we need a pseudoclock. I have no real idea how this can be realized, but I still wonder, what @timestamp is for, if it cannot combined with the normal clock. -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029858.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion, Insert Events with timestamp in the past.
Yes, t(measurment) t(insert). The sensors communicate with the server with 3g, which might be slow in some situations. I simplify my question: Can I use @timestamp with realtime-clocks? -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029860.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion, Insert Events with timestamp in the past.
I am really thankful about your patience. Please do not focus on the network delay so far, there are other processes, which can cause the delay. Perhaps I will find a better solution here, but I would prefer to understand what is happing first. Can you explain me the following examples? 1. First example: LHS: $e: Message (Message(this after [0, 10sec] $e), where Message has an @timestamp 1.1. insert(new Message(NOW().subtract(5sec))); -- 11am wait(6sec); insert(new Message(NOW())); // NOT Activated 1.2. insert(new Message(NOW().subtract(5sec))); -- 11am wait(2sec); insert(new Message(NOW())); // Activated at 11:05am 2. First example: LHS: $e: Message not (Message(this after [0, 10sec] $e), where Message has an @timestamp insert(new Message(NOW().subtract(5sec))); -- 11am // Activated at 11:10am Example 1.1 and 1.2 works as expected and my timestamp is respected but not example 2. Can you give me some hints about the hot-deployment for rules? -- View this message in context: http://drools.46999.n3.nabble.com/Fusion-Insert-Events-with-timestamp-in-the-past-tp4029843p4029866.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users