ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mimmo Celano <mimmo.celano1...@gmail.com>
Subject Re: Ignite Information
Date Tue, 11 Jul 2017 13:15:50 GMT
Hi thanks for the reply.

We can't filter data.

public class NodeFilter implements IgnitePredicate<ClusterNode> {

private static final long serialVersionUID = 0L;

    public NodeFilter() {
        System.out.println("Start NodeFilter");

    @Override public boolean apply(ClusterNode node) {


        Map<String, Object> nodeAttrs = node.attributes();

            System.out.println("Attr = "+nodeAttrs.get("id").toString());

return true;

This is the class Filter, which print just information about the node

Node attributes are added in xml config file

<bean id="ignite.cfg"

        <!-- Explicitly configure TCP discovery SPI to provide list of
initial nodes. -->
        <property name="discoverySpi">
                <property name="ipFinder">
                        Ignite provides several options for automatic
discovery that can be used
                        instead os static IP based discovery. For
information on all options refer
                        to our documentation:
                    <!-- Uncomment static IP finder to enable static-based
discovery of initial nodes. -->
                        <property name="addresses">
                                <!-- In distributed environment, replace
with actual host IP address. -->
        <property name="peerClassLoadingEnabled" value="true"/>
        <property name="userAttributes">
                        <entry key="id" value="uno"/>

We set it to cache configuration

     ignite =
     CacheConfiguration<String,Long> cfg2=
-->cfg2.setNodeFilter(new NodeFilter());
     cache = ignite.getOrCreateCache(cfg2);

but when we put data into the cache, the filter is not setted. The
"println" in apply function is not starting, so the function is not called.
The filter returns everytime true, it's just an example to test it.

Are we doing something wrong about setting the filter?


2017-07-08 1:51 GMT+02:00 ignite_user2016 <rishiyagnik@gmail.com>:

> Thanks .. Val
> I will look at it in detail.
> Take Care,
> Rishi
> On Jul 7, 2017, at 2:17 PM, vkulichenko [via Apache Ignite Users] <[hidden
> email] <http:///user/SendEmail.jtp?type=node&node=14518&i=0>> wrote:
> You can read here about user attributes: https://apacheignite.readme.
> io/docs/cluster#cluster-node-attributes
> For the node filter example, refer to JavaDoc: https://github.com/apache/
> ignite/blob/master/modules/core/src/main/java/org/apache/ignite/util/
> AttributeNodeFilter.java
> -Val
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://apache-ignite-users.70518.x6.nabble.com/Ignite-
> Information-tp14330p14509.html
> To start a new topic under Apache Ignite Users, email [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=14518&i=1>
> To unsubscribe from Apache Ignite Users, click here.
> <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> ------------------------------
> View this message in context: Re: Ignite Information
> <http://apache-ignite-users.70518.x6.nabble.com/Ignite-Information-tp14330p14518.html>
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.

View raw message