-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[AMQ-9530]Fix SelectorAwareVirtualTopicInterceptor ClassCastException if next is not Topic. #1247
base: main
Are you sure you want to change the base?
Conversation
What is the use case for this? |
you mean the use case of having a DestinationFilter after SelectorAwareVirtualTopicInterceptor? I my case I add an interceptor to all topics. and that interceptor coexists with the rest of interceptors. and some topics can be vistual topics. it's technically possible on the plugin side to check if there is a virtual topic interceptor and not add my interceptor. But I checked other interceptors(this one for example) and they handle this situation correctly, so I thought it would be a positive change in general. In case people decide to do something similar in the future, they will not need to work around the edge case. |
...ain/java/org/apache/activemq/broker/region/virtual/SelectorAwareVirtualTopicInterceptor.java
Outdated
Show resolved
Hide resolved
8594de6
to
7bb0e82
Compare
A couple of points:
|
7bb0e82
to
88da503
Compare
Done. https://issues.apache.org/jira/browse/AMQ-9530
Updated
There are no issues like this in other pars of the Virtual Destination code. only in |
MappedQueueFilter has a nearly identical method: ref: Line 90 in 5309352
|
are you proposing to extract this method to a helper class? If I create a new class, let's say VirtualTopicSupport or VistualTopicHelper, will it be okay? or do you have a particular place in mind fir it? |
Yes, a base class that contains the lookup method to unwrap the destination to get to the root (real) destination that can be used by VirtualTopic and MappedQueueFilter. ie BaseVirtualDestination(Inteceptor|Filter) |
88da503
to
7336803
Compare
sounds good! done |
...er/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java
Show resolved
Hide resolved
...er/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java
Outdated
Show resolved
Hide resolved
… if next is not Topic.
7336803
to
bdf6332
Compare
next
is not guaranteed to be Topic. If there is plugin that injects anotherDestinationInterceptor
, the code will fail withClassCastException
.Added a method to correctly unwrap next.
Ran:
to make sure there is no regression