activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hackingbear <hackingb...@gmail.com>
Subject Network broker and filter predicate
Date Mon, 09 Nov 2009 00:27:50 GMT

Hi,

In our setup, we have a backbone broker running the verbatim AMQ 5.3 and a
5.3 broker without our own BrokerFilter (gateway broker.) The gateway broker
is for serving clients connecting from the Internet. One thing the broker
does is to ensure only the right messages can be consumed, like:

    public Subscription addConsumer(ConnectionContext context, ConsumerInfo
info) throws Exception {
            PropertyExpression filterProp = new
PropertyExpression("FILTER_VALUE");
            List<String> elements = Arrays.asList("A", "B", "C", "D");
            BooleanExpression predicate =
ComparisonExpression.createInFilter(filterProp, elements);
            info.setAdditionalPredicate(predicate);

The config file is currently very simple:

<beans ...>
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>

  <broker xmlns="http://activemq.apache.org/schema/core" brokerName="tsgw" 
plugins="#gatewayPlugin">

    <networkConnectors>
        <networkConnector uri="static:(tcp://localhost:61616)"
duplex="true"/>
    </networkConnectors>
    <persistenceAdapter>
      <memoryPersistenceAdapter />
    </persistenceAdapter>

    <transportConnectors>
      <transportConnector uri="tcp://localhost:62002" />
    </transportConnectors>

  </broker>
  <bean id="gatewayPlugin" class="amq.GatewayPlugin" />
</beans>

Then when the filter code runs, I will get an exception shown below, which
also seems to throw the gateway broker in disarray as it keeps trying the
same thing with same errors. If I comment out the setaddtionalPredicate(),
the error goes away.

Looking around the AMQ codes, the boolean/unary expressions indeed do not
implement the DataStructure and this marshaller indeed is trying to cast to
DataStructure. Further, SimpleAuthorizationBroker just instantiates a
BooleanExpression. 

So I wonder if this has to do with network broker setup. How can I fix/work
around this problem?

Greatly appreciate for any help!!

----

 WARN DemandForwardingBridge Caught an exception processing local command
[@BrokerService] 2009-11-08 15:22:40,877
java.lang.ClassCastException: org.apache.activemq.filter.UnaryExpression$2
cannot be cast to org.apache.activemq.command.DataStructure
	at
org.apache.activemq.openwire.v3.ConsumerInfoMarshaller.tightMarshal1(ConsumerInfoMarshaller.java:127)
	at
org.apache.activemq.openwire.OpenWireFormat.tightMarshalNestedObject1(OpenWireFormat.java:397)
	at
org.apache.activemq.openwire.v3.BaseDataStreamMarshaller.tightMarshalNestedObject1(BaseDataStreamMarshaller.java:131)
	at
org.apache.activemq.openwire.v3.MessageMarshaller.tightMarshal1(MessageMarshaller.java:132)
	at
org.apache.activemq.openwire.v3.ActiveMQMessageMarshaller.tightMarshal1(ActiveMQMessageMarshaller.java:77)
	at
org.apache.activemq.openwire.OpenWireFormat.marshal(OpenWireFormat.java:228)
	at
org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:166)
	at
org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:233)
	at
org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:83)
	at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:100)
	at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
	at
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
	at
org.apache.activemq.network.DemandForwardingBridgeSupport.serviceLocalCommand(DemandForwardingBridgeSupport.java:647)
	at
org.apache.activemq.network.DemandForwardingBridgeSupport$1.onCommand(DemandForwardingBridgeSupport.java:147)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:104)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at
org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:113)
	at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
	at
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
	at
org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:1207)
	at
org.apache.activemq.broker.TransportConnection.processDispatch(TransportConnection.java:793)
	at
org.apache.activemq.broker.TransportConnection.iterate(TransportConnection.java:830)
	at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
	at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

-- 
View this message in context: http://old.nabble.com/Network-broker-and-filter-predicate-tp26259578p26259578.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message