-
Notifications
You must be signed in to change notification settings - Fork 13
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/timed rules support #114
Feature/timed rules support #114
Conversation
// http://esper.espertech.com/release-6.0.1/esper-reference/html/event_patterns.html#pattern-timer-at | ||
// http://esper.espertech.com/release-6.0.1/esper-reference/html/event_patterns.html#pattern-timer-schedule | ||
return ruleText.toLowerCase().contains(" timer:") || | ||
(ruleText.toLowerCase().contains(" match_recognize") && ruleText.toLowerCase().contains("interval")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the withespace just before match_recogineze
correct in contains() argument? (just checking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
Better we removed it. Right now it works fine, but if the rules will have line breaks one day, it could become a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 589775e
* It implements a method that, following the same mechanism as putCorrelatorAndTrans, uses org.slf4j.MDC | ||
* to store the necessary headers, which will be necessary for the request in pursuit of activation of | ||
* an action. The same thread will use the MDC to extract this data. | ||
* @param rule JSON with the rule information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: blank line in JavaDoc just before @param
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 589775e
CHANGES_NEXT_RELEASE
Outdated
- Upgrade maven-javadoc-plugin from 2.9 to 3.0.1 | ||
- Add: support for esper 6.1.0 timed rules("timer:XX" patterns and Match Recognize interval patterns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CNR line should mention the issue being solved. In addition a whitepsace whould be added before (
(seems to be a typo). In sum, something like this:
- Add: support for esper 6.1.0 timed rules("timer:XX" patterns and Match Recognize interval patterns) (#91)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 589775e
@@ -151,8 +162,15 @@ protected void doDelete(HttpServletRequest request, HttpServletResponse response | |||
response.setContentType("application/json;charset=UTF-8"); | |||
PrintWriter out = response.getWriter(); | |||
logger.info("delete rule " + request.getPathInfo()); | |||
//request.getPathInfo() returns null or the extra path information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about if request.getPathInfo() retruns null (as you mention in the comment)? I undesratnad that ruleName.substring(1)
will result in NullPointeException. Is that exception being managed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have trying to add a new test following the model of those that already exist to verify this circumstance, but with the current behavior of the method of the Help class used for the requests, an empty path that returns a null can never arrive. So at least a "/" will arrive
But I think in the real world this case can happen. If I add a check for this null, the expected behavior would be that the server would return a 404 error, 405, other?
if (ruleName == null) { response.setStatus(405); out.println("Method not alowed"); out.close(); return; }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember the "small letter" :) of the HTTP RFC, but I'd say that 405 means that the URL is correct but the verb is wrong. In this case maybe a general 400 Bad Request is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a 405 would be more appropriate when for example you try to do a PUT to an endpoint that does not accept this type of operation. I think a 400 is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b33c0d6
*/ | ||
private boolean isTimeRule(String ruleText) { | ||
// Detect timed rules, searching "timer:XX" patterns or Match_Recognize interval patterns | ||
// http://esper.espertech.com/release-6.0.1/esper-reference/html/match-recognize.html#match-recognize-interval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are URLs correct? I mean, I understand we are using Esper 6.1.0 but URL uses release-6.0.1...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 589775e
Thanks for the contribution! I have provide some comments (I understand of minor nature) Please have a look to this issue telefonicaid/perseo-fe#303, which I understand is related with this PR (ideally, should be addressed at the same time). |
It seems that commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the contribution!
Let's merge now and see how it goes in todays nightly e2e regression :)
Perfect. Thank you very much Fermin |
Regression testing went ok :) |
Fix #91
This PR support for Esper 6.1.0 timed rules:
"timer:XX" patterns or Match_Recognize interval patterns