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

Enable use of PathPattern for RSocket routing #22642

Closed
bclozel opened this issue Mar 22, 2019 · 2 comments
Closed

Enable use of PathPattern for RSocket routing #22642

bclozel opened this issue Mar 22, 2019 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Mar 22, 2019

As of #21292, Spring Messaging supports RSocket.

The RSocketMessageHandler implementation extends MessageMappingMessageHandler, which is using an AntPathMatcher as a base for pattern matching. We know that this implementation is not the most optimized, as we have used PathPatternParser in Spring WebFlux.

Since PathPatternParser and PathPattern can be seen as general purpose utilities, should we move those from spring-web to spring-core? We could keep the current ones in place, deprecate them and make them extend the new ones in spring-core.

To be used in Spring Messaging, we'd need to add a new configuration option in PathPatternParser to change the separator, which is currently hardcoded to / - it seems this class has been designed with this possibility in mind.

@bclozel bclozel added for: team-attention status: waiting-for-triage An issue we've not yet triaged or decided on in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Mar 22, 2019
@rstoyanchev
Copy link
Contributor

We did state this for PathPatternParser. In retrospect however those stated benefits apply also to scenarios with runtime pattern matching to some input path, under load and a potentially long list of patterns, i.e. like the RSocket case.

For the syntax, I don't see anything that makes PathPattern married to HTTP URLs. It did make some syntax refinements compared to AntPathMatcher but those were more geared at the needs of matching to some input path at runtime as opposed to "Ant paths" where the original goal was matching to resources such as files.

For the implementation, note that such a change would also involve PathContainer which is the input type to PathPattern and currently resides in http.server. I do wonder if there is another way to achieve this for example by creating some common abstraction in spring-core with spring-web having the only implementation created for HTTP but usable for other processing scenarios too. It would mean that spring-messaging requires spring-web for pattern matching in RSocket but we already have that question for codecs with spring-web containing mots of the useful ones, e.g for json and protobuf.

@rstoyanchev rstoyanchev changed the title Consider moving PathPattern to spring-core Enable use of PathPattern for RSocket routing May 10, 2019
@rstoyanchev rstoyanchev self-assigned this May 10, 2019
@rstoyanchev rstoyanchev removed for: team-attention status: waiting-for-triage An issue we've not yet triaged or decided on labels May 10, 2019
@rstoyanchev rstoyanchev added this to the 5.2 M3 milestone May 10, 2019
@rstoyanchev
Copy link
Contributor

MessageMappingMessageHandler now accepts an RouteMatcher instead of PathMatcher which can be used with a PathPattern based RouteMatcher implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants