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/timed rules support #114

Merged
merged 8 commits into from
Nov 22, 2018

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"));
Copy link
Member

@fgalan fgalan Nov 20, 2018

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)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 589775e

- 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)
Copy link
Member

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)

Copy link
Contributor Author

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
Copy link
Member

@fgalan fgalan Nov 20, 2018

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?

Copy link
Contributor Author

@cblanco cblanco Nov 22, 2018

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;
    }

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Member

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 589775e

@fgalan
Copy link
Member

fgalan commented Nov 20, 2018

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).

@fgalan
Copy link
Member

fgalan commented Nov 22, 2018

It seems that commit 589775e solves some of the comments. Could you add a Fixed in 589775e response to them for the sake of traceability, please? Thanks!

Copy link
Member

@fgalan fgalan left a 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 :)

@fgalan fgalan merged commit 31b0853 into telefonicaid:master Nov 22, 2018
@cblanco
Copy link
Contributor Author

cblanco commented Nov 22, 2018

Perfect. Thank you very much Fermin

@fgalan
Copy link
Member

fgalan commented Nov 23, 2018

Regression testing went ok :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants