There is no Channel.addDataFilter(DataFilter)
method, but you can achieve the same results in a different way.
First, have a look at the available DataFilter
implementations already available.
Then it's enough that you add a DataFilterMessageListener
to the channel you want to filter data on, and specify one or more DataFilter
to the DataFilterMessageListener
.
You can find an example of this in the CometD demos shipped with the CometD distribution, for example here.
The right way to add the DataFilterMessageListener
is during channel initialization, as it is done in the example linked above through a @Configure
annotation, or equivalently via ServerChannel.Initializer
.
Finally, have a look at how messages are processed on the server from the documentation: http://docs.cometd.org/reference/#concepts_message_processing.
It is important to understand that modifications made by DataFilter
are seen by all subscribers.