Skip to content

Conversation

@greyp9
Copy link
Contributor

@greyp9 greyp9 commented Jan 7, 2026

Summary

NIFI-15441

  • Update ListenUDP documentation to reflect output FlowFile attribute udp.port as being the listening port (do not change behavior).
  • Update ListenUDP output FlowFile attribute udp.sender to include remote port, via use of InetSocketAddress.toString(). Example: from /127.0.0.1 to /127.0.0.1:54545

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 contains commits signed with a registered key indicating Verified status

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 ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

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

@exceptionfactory exceptionfactory changed the title ListenUDP - include sending port in 'sender' attr; correct attr doc NIFI-15441 ListenUDP - include sending port in 'sender' attr; correct attr doc Jan 8, 2026
Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

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.

@greyp9
Copy link
Contributor Author

greyp9 commented Jan 8, 2026

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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a second ctor here so as not to impact ListenUDPRecord. Not sure if we want to propagate the PR there as well.

@Override
public StandardEvent create(final byte[] data, final Map<String, String> metadata, final ChannelResponder responder) {
String sender = null;
String senderPort = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

StandardEventFactory looks like it is used to populate FF attributes, so I chose to use a String to hold the port data (if known).

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));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that I'm looking at this again, we may want to use the three arg ctor here?

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