spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

There is no explanation about how to use NIO for UDP

Open clayly opened this issue 2 years ago • 5 comments

In what version(s) of Spring Integration are you seeing this issue?

6.1.1

Describe the bug

There is no explanation in documentation about how to use NIO for UDP neither corresponding methods or attributes in API.

To Reproduce

Look here: https://docs.spring.io/spring-integration/reference/html/ip.html#ip

Expected behavior

There should be explanation how to use NIO for UDP or clear explatation why it's impossible.

Sample

There is no examles of using UDP adapters with NIO.

clayly avatar Jun 25 '23 14:06 clayly

There is currently no support for NIO with UDP in this project.

It would only make sense to implement it if a single inbound adapter could support reading from multiple sockets, which is currently not the case. It would require an architectural change.

See https://stackoverflow.com/questions/16048284/whats-the-point-of-using-udp-with-nio for a discussion about this.

Contributions are welcome.

garyrussell avatar Jun 25 '23 15:06 garyrussell

It would only make sense to implement it if a single inbound adapter could support reading from multiple sockets, which is currently not the case. It would require an architectural change.

I think it would also make sense to implement it even if there is multiple inbound adapters with single socket in each but they all share same EventLoopGroup (e. g. for Netty), which is quite normal. What do you think?

clayly avatar Jun 25 '23 16:06 clayly

Right, but that's still an architectural change, to externalize the event handling to a shared component.

garyrussell avatar Jun 25 '23 18:06 garyrussell

May be we just need to look into a new pair of channel adapters based on Reactor Netty:

https://projectreactor.io/docs/netty/release/reference/index.html#udp-server https://projectreactor.io/docs/netty/release/reference/index.html#udp-client ?

artembilan avatar Jun 26 '23 14:06 artembilan

May be we just need to look into a new pair of channel adapters based on Reactor Netty:

https://projectreactor.io/docs/netty/release/reference/index.html#udp-server https://projectreactor.io/docs/netty/release/reference/index.html#udp-client ?

It's what I use now instead of UDP integration adapters.

clayly avatar Jun 26 '23 17:06 clayly

I would suggest to repurpose this issue into something like new spring-integration-netty module. And there we would look into a UDP part how to implement it based on the Netty library. Or something what is on top of that, like Reactor Netty: https://projectreactor.io/docs/netty/milestone/reference/about-doc.html

artembilan avatar Oct 08 '25 20:10 artembilan