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

DefaultUserDestinationResolver does not support "." separator convention [SPR-14044] #18616

Closed
spring-projects-issues opened this issue Mar 11, 2016 · 5 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 11, 2016

Ali Shahbour opened SPR-14044 and commented

When using Artemis as StompBrokerRelay , queue names should follow jms for example jms.queue.call.

Every thing worked fine except when trying to send message or subscribe to user queue , i subscribe to queue like this /user/jms.queue.call, it did not work and the reason is in DefaultUserDestinationResolver and specifically in:

private ParseResult parse(Message<?> message) 
.
.
int prefixEnd = this.prefix.length() - 1;
String actualDestination = destination.substring(prefixEnd);

The actualDestination is resolved as /jms.queue.call which did not work with Artemis.

Same for sending message:

int prefixEnd = this.prefix.length();
int userEnd = destination.indexOf('/', prefixEnd);
Assert.isTrue(userEnd > 0, "Expected destination pattern \"/user/{userId}/**\"");
String actualDestination = destination.substring(userEnd);
String subscribeDestination = this.prefix.substring(0, prefixEnd - 1) + actualDestination;

ActualDestination had the same extra /.

I removed these through debugging and it worked.

Shouldn't DefaultUserDestinationResolver support both . and / as delimiter ?


Affects: 4.2.5

Issue Links:

Referenced from: commits 1835942

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 14, 2016

Ali Shahbour commented

Yes and it working normally for example (working example) the problem is only when subscription or message is sent to specific user destination as /user/jms.queue.call

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 15, 2016

Rossen Stoyanchev commented

Okay I see the issue now. DefaultUserDestinationResolver transforms /user/jms.queue.call into /jms.queue.call-joe based on the configured prefix /user/ which it looks for and then drops the /user part leaving the leading / in place in the transformed destination. There is a built-in assumption there that you want the leading / which is not the case when the broker favors . as the separator.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 15, 2016

Rossen Stoyanchev commented

I've added a fix where DefaultUserDestinationResolver looks at the configured PathMatcher and leaves out the leading / if the PathMatcher is configured with an alternative separator.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 17, 2016

Ali Shahbour commented

Great thanks for the super fast commit , is it possible to override the current implementation of
DefaultUserDestinationResolver so i do the substring until the version is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants