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

Consider making FileTailingEvent#getMessage() method public #3286

Closed
Toparvion opened this issue May 20, 2020 · 3 comments
Closed

Consider making FileTailingEvent#getMessage() method public #3286

Toparvion opened this issue May 20, 2020 · 3 comments

Comments

@Toparvion
Copy link
Contributor

Expected Behavior

FileTailingMessageProducerSupport.FileTailingEvent#getMessage method might be public instead of protected to allow application code be aware of what is happening with a file being tailed.

Current Behavior

Currently, when handling FileTailingEvents, application listeners have no access to the message produced by the underlying tail implementation. Therefore they cannot distinguish one file event type from another (e.g. absence from rotating) thus making the handling inefficient.

Context

I realize that it is generally not a good idea to rely on the text of the event as it comes from the underlying tailing provider (such as Apache Commons or OS Delegate) and thus can vary greatly depending on the platform. Nonetheless, there are some use cases where the message is still needed, for example:

  • to handle the event appropriately if the tail implementation is fixed and is known beforehand
  • to build some 'heuristic' around the message to cover different implementations where needed
  • just to inform the end user (toString() method is too verbose for that)

The only alternative I see at the moment is to parse the toString() method output but it seems irrational and brittle.

If there is no security/compatibility/etc reason for keeping the method protected, I would submit a pull request making it public with the corresponding javadoc warning about its changeable nature.

@Toparvion Toparvion added status: waiting-for-triage The issue need to be evaluated and its future decided type: enhancement labels May 20, 2020
@garyrussell garyrussell added backport 4.3.x and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels May 20, 2020
@garyrussell garyrussell added this to the 5.4 M1 milestone May 20, 2020
@garyrussell
Copy link
Contributor

I am sure this was just a simple mistake (probably some IDE auto-created getter); I can't believe it has taken 7 years for this to be reported.

@artembilan
Copy link
Member

@Toparvion ,
please, consider to raise a simple PR!

Thanks

Toparvion added a commit to Toparvion/spring-integration that referenced this issue May 21, 2020
To provide application code with a way to properly handle original messages emitted from the underlying tailing producer
@Toparvion
Copy link
Contributor Author

@artembilan , @garyrussell , thank you for the welcoming reply!
I've submitted the pull request.

Toparvion added a commit to Toparvion/spring-integration that referenced this issue May 21, 2020
To provide application code with a way to properly handle original messages emitted from the underlying tailing producer
artembilan pushed a commit that referenced this issue May 21, 2020
Fixes #3286

The `FileTailingEvent.getMessage()` is really meant to be as `public`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
artembilan pushed a commit that referenced this issue May 21, 2020
Fixes #3286

The `FileTailingEvent.getMessage()` is really meant to be as `public`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
artembilan pushed a commit that referenced this issue May 21, 2020
Fixes #3286

The `FileTailingEvent.getMessage()` is really meant to be as `public`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
artembilan pushed a commit that referenced this issue May 21, 2020
Fixes #3286

The `FileTailingEvent.getMessage()` is really meant to be as `public`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
# Conflicts:
#	spring-integration-file/src/main/java/org/springframework/integration/file/tail/FileTailingMessageProducerSupport.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants