You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "mihaela.ion" <mi...@gmail.com> on 2011/02/17 14:14:16 UTC

Writing complex filters

Dear all,

I need to filter messages based on more complex filters with a specific
structure (different from selector). When a filter is first registered with
a broker, the broker needs to do some pre-processing. Is it possible to
define my own filter and matching method and used it with activemq? How? 

Thanks,
Mihaela
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Writing-complex-filters-tp3310736p3310736.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Writing complex filters

Posted by "mihaela.ion" <mi...@gmail.com>.
Thank you for the good pointers. I am only interested in filters for topics.
I created a custom dispatch policy. However, I am not able to configure
properly the activemq.xml file. Following the example from
http://activemq.apache.org/how-do-i-change-dispatch-policy.html I used:
<destinationPolicy>
   <policyMap><policyEntries> 
      <policyEntry topic="COMMAND.>">
         <dispatchPolicy>
           <myDispatchPolicy />
         </dispatchPolicy>
         <subscriptionRecoveryPolicy>
            <noSubscriptionRecoveryPolicy />
         </subscriptionRecoveryPolicy>
      </policyEntry>
   </policyEntries></policyMap>
</destinationPolicy>
I tried to use <bean id="myDispatchPolicy"
class="filter.MyTopicDispatchPolicy"
xmlns="http://activemq.apache.org/schema/core"/> but I get an error. How
should I configure the file?
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Writing-complex-filters-tp3310736p3311149.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Writing complex filters

Posted by Gary Tully <ga...@gmail.com>.
The selector parser is not plug-able, so this will require a bit of surgery.

Given your own parser/filter, for topics, you can plug in your own dispatch
policy.
eg: org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy

For queues there is org.apache.activemq.broker.region.QueueDispatchSelector
but that is not plug-able atm either.

Check out how both are used internally in Queue and Topic for some start
points.


On 17 February 2011 13:14, mihaela.ion <mi...@gmail.com> wrote:

>
> Dear all,
>
> I need to filter messages based on more complex filters with a specific
> structure (different from selector). When a filter is first registered with
> a broker, the broker needs to do some pre-processing. Is it possible to
> define my own filter and matching method and used it with activemq? How?
>
> Thanks,
> Mihaela
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Writing-complex-filters-tp3310736p3310736.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>



-- 
http://blog.garytully.com
http://fusesource.com