NIFI-15441 ListenUDP - include sending port in 'sender' attr; correct attr doc#10743
NIFI-15441 ListenUDP - include sending port in 'sender' attr; correct attr doc#10743exceptionfactory merged 4 commits intoapache:mainfrom
Conversation
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for proposing this adjustment @greyp9.
Although changing udp.sender to include the port number preserves the host, the addition of the port may have an impact on flow designs that expect udp.sender to contain only the host address.
Given the long-standing nature of this FlowFile attribute value, it seems better to introduce the sending port in a different attribute, with udp.sender.port as a good potential option. That would provide the additional information, without changing the current definition of udp.sender.
Thanks, sounds good. |
| this(sender, null, data, responder); | ||
| } | ||
|
|
||
| public StandardEvent(final String sender, final String senderPort, final byte[] data, final ChannelResponder<C> responder) { |
There was a problem hiding this comment.
I added a second ctor here so as not to impact ListenUDPRecord. Not sure if we want to propagate the PR there as well.
| mockEvents.add(new StandardEvent<>(sender1, message, responder)); | ||
| mockEvents.add(new StandardEvent<>(sender2, message, responder)); | ||
| mockEvents.add(new StandardEvent<>(sender2, message, responder)); | ||
| mockEvents.add(new StandardEvent<>(sender1, senderPort1, message, responder)); |
There was a problem hiding this comment.
Now that I'm looking at this again, we may want to use the three arg ctor here?
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @greyp9. The implementation looks good, I noted one more minor comment on a test assertion. I agree with keeping this scoped to ListenUDP, perhaps ListenUDPRecord could be considered in a separate Jira issue after this one is completed.
| flowFile.assertContentEquals("This is message " + (i + 1)); | ||
| assertEquals(String.valueOf(port), flowFile.getAttribute(ListenUDP.UDP_PORT_ATTR)); | ||
| assertTrue(StringUtils.isNotEmpty(flowFile.getAttribute(ListenUDP.UDP_SENDER_ATTR))); | ||
| assertEquals(5, flowFile.getAttribute(ListenUDP.UDP_SENDER_PORT_ATTR).length()); // send port expected to be in ephemeral range |
There was a problem hiding this comment.
On some machines, the ephemeral range starts with 1024. Instead of checking the length, using StringUtils.isNumeric() seems like a better check.
There was a problem hiding this comment.
On some machines, the ephemeral range starts with
1024. Instead of checking the length, usingStringUtils.isNumeric()seems like a better check.
That's definitely better; thanks!
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks @greyp9, the latest version looks good, +1 merging
…che#10743) Signed-off-by: David Handermann <exceptionfactory@apache.org>
…che#10743) Signed-off-by: David Handermann <exceptionfactory@apache.org>
Summary
NIFI-15441
ListenUDPdocumentation to reflect output FlowFile attributeudp.portas being the listening port (do not change behavior).ListenUDPoutput FlowFile attributeudp.senderto include remote port, via use ofInetSocketAddress.toString(). Example: from/127.0.0.1to/127.0.0.1:54545Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation