You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Jonathan Gallimore (Jira)" <ji...@apache.org> on 2021/05/24 10:04:00 UTC

[jira] [Commented] (AMQ-8277) Subscriber with additional predicate causes ClassCastException and doesn't forward messages between brokers

    [ https://issues.apache.org/jira/browse/AMQ-8277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17350332#comment-17350332 ] 

Jonathan Gallimore commented on AMQ-8277:
-----------------------------------------

PR: https://github.com/apache/activemq/pull/656

> 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: 10m
>  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)