Skip to content

NIFI-10737 Correct ListenBeats buffer handling#6608

Closed
exceptionfactory wants to merge 1 commit intoapache:mainfrom
exceptionfactory:NIFI-10737
Closed

NIFI-10737 Correct ListenBeats buffer handling#6608
exceptionfactory wants to merge 1 commit intoapache:mainfrom
exceptionfactory:NIFI-10737

Conversation

@exceptionfactory
Copy link
Contributor

@exceptionfactory exceptionfactory commented Nov 1, 2022

Summary

NIFI-10737 Corrects the behavior of the ListenBeats Processor when reading a socket buffer where the buffer size is greater than 2048 bytes.

The Netty framework can invoke handlers with a ByteBuf containing any number of bytes, so the handler implementations must be capable of checking for available bytes and resuming operation on subsequent invocations.

Changes include adding a new unit test for ListenBeats, removing unnecessary dependencies from nifi-beats-processors, and implementing a new BatchDecoder class for reading Beats Protocol frames. The protocol implementation follows the general approach of the logstash-input-beats project for reading Beats Version 2 frames.

The channel handler process is also more efficient as it sends a Message Acknowledgement packet for the last Sequence Number from the batch of messages, as opposed to sending one for every message received.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 8
    • JDK 11
    • JDK 17

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

- Added test class for ListenBeats
- Removed unnecessary dependencies
- Implemented BatchDecoder for reading Beats Protocol frames
- Refactored protocol and handler classes
@thenatog
Copy link
Contributor

thenatog commented Nov 4, 2022

Will review

@thenatog
Copy link
Contributor

thenatog commented Nov 7, 2022

+1 looks good to me, tested this out and found that ListenBeats is working as expected. The refactor code changes look good. Will merge.

@thenatog thenatog closed this in 7c1a7da Nov 7, 2022
lizhizhou pushed a commit to lizhizhou/nifi that referenced this pull request Jan 2, 2023
- Added test class for ListenBeats
- Removed unnecessary dependencies
- Implemented BatchDecoder for reading Beats Protocol frames
- Refactored protocol and handler classes

Signed-off-by: Nathan Gough <thenatog@gmail.com>

This closes apache#6608.
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