[
https://issues.apache.org/jira/browse/AMQ-8277?focusedWorklogId=601121&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-601121
]
ASF GitHub Bot logged work on AMQ-8277:
---------------------------------------
Author: ASF GitHub Bot
Created on: 24/May/21 11:22
Start Date: 24/May/21 11:22
Worklog Time Spent: 10m
Work Description: cshannon edited a comment on pull request #656:
URL: https://github.com/apache/activemq/pull/656#issuecomment-846975779
The main issue I see here is what you pointed out...while this prevents the
error it would result in not filtering between brokers and may cause unintended
behavior which isn't great either and the only real way to fix it is to make
the predicate be included by OpenWire (maybe another version or what you
already tried)
For the topic scenario (and using conduit subscriptions) it would work fine
as selectors are not used anyways as it is pub/sub and messages are just
broadcast so when the messages hit the different brokers they can be filtered
there.
When using a queue with multiple consumers I would think this would lead to
stuck messages. For example a scenario might be if you had 3 brokers (A, B, C)
and you create consumers on A and B with different predicates but those
predicates are now filtered out when creating demand with advisories. That
means if a message is published to broker C that could would match the
predicate on consumer on A but not B it may still be forwarded to B and now
stuck.
I'm not really sure how much it matters as I doubt many people are doing
this as this issue would have been brought up more often. This fix would
probably be ok as long as we update the documentation on the network of brokers
page and add something that specifically points out that if that field is set a
network of brokers ignores it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 601121)
Time Spent: 0.5h (was: 20m)
> Subscriber with additional predicate causes ClassCastException and doesn't
> forward messages between brokers
> -----------------------------------------------------------------------------------------------------------
>
> Key: AMQ-8277
> URL: https://issues.apache.org/jira/browse/AMQ-8277
> Project: ActiveMQ
> Issue Type: Bug
> Affects Versions: 5.16.2
> Reporter: Jonathan Gallimore
> Priority: Major
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> I have a network of brokers set up, and use a plugin to set the additional
> predicate, to enable message filtering based on the consumer.
> (JavaDoc for MessageConsumer.setAdditionalPredicate() is "A transient
> additional predicate that can be used it inject additional predicates into
> the selector on the fly. Handy if if say a Security Broker interceptor wants
> to filter out messages based on security level of the consumer.")
> This works fine for a single broker, or in a failover scenario, but if used
> with a network of brokers, whenever the consumer starts, the following
> exception is thrown, and messages are not forwarded across the network for
> this consumer.
>
> java.lang.ClassCastException: class
> org.apache.activemq.filter.ComparisonExpression$1 cannot be cast to class
> org.apache.activemq.command.DataStructure
> (org.apache.activemq.filter.ComparisonExpression$1 and
> org.apache.activemq.command.DataStructure are in unnamed module of loader
> org.apache.catalina.loader.ParallelWebappClassLoader @749f539e)
> at
> org.apache.activemq.openwire.v12.ConsumerInfoMarshaller.tightMarshal1(ConsumerInfoMarshaller.java:133)
> at
> org.apache.activemq.openwire.OpenWireFormat.tightMarshalNestedObject1(OpenWireFormat.java:400)
> at
> org.apache.activemq.openwire.v12.BaseDataStreamMarshaller.tightMarshalNestedObject1(BaseDataStreamMarshaller.java:130)
> at
> org.apache.activemq.openwire.v12.MessageMarshaller.tightMarshal1(MessageMarshaller.java:140)
> at
> org.apache.activemq.openwire.v12.ActiveMQMessageMarshaller.tightMarshal1(ActiveMQMessageMarshaller.java:76)
> at
> org.apache.activemq.openwire.OpenWireFormat.tightMarshalNestedObject1(OpenWireFormat.java:400)
> at
> org.apache.activemq.openwire.v12.BaseDataStreamMarshaller.tightMarshalNestedObject1(BaseDataStreamMarshaller.java:130)
> at
> org.apache.activemq.openwire.v12.MessageDispatchMarshaller.tightMarshal1(MessageDispatchMarshaller.java:87)
> at
> org.apache.activemq.openwire.OpenWireFormat.marshal(OpenWireFormat.java:226)
> at
> org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:193)
> at
> org.apache.activemq.transport.AbstractInactivityMonitor.doOnewaySend(AbstractInactivityMonitor.java:335)
> at
> org.apache.activemq.transport.AbstractInactivityMonitor.oneway(AbstractInactivityMonitor.java:317)
> at
> org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:94)
> at
> org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:116)
> at
> org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
> at
> org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:1474)
> at
> org.apache.activemq.broker.TransportConnection.processDispatch(TransportConnection.java:972)
> at
> org.apache.activemq.broker.TransportConnection.iterate(TransportConnection.java:1022)
> at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)
> at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> at java.base/java.lang.Thread.run(Thread.java:834)
>
> This is very similar to the exception noted in this query:
> [http://activemq.2283324.n4.nabble.com/Network-broker-and-filter-predicate-td2367038.html]
>
> This appears to be down to the *Expression objects not implementing
> DataStructure, and therefore not being marshalable to OpenWire format.
> I have prepared a simple patch with a unit test which I'll provide as a PR.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)