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) {


        System.out.println(""+node.attribute("id"));



        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
attributes.

Node attributes are added in xml config file

<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">

        <!-- Explicitly configure TCP discovery SPI to provide list of
initial nodes. -->
        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <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:
http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based
discovery of initial nodes. -->
                    <!--<bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinde$
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMultic$
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace
with actual host IP address. -->
                                <value>127.0.0.1:47500..47509</value>
                                <value>192.168.30.5:47500..47509</value>
                                <value>192.168.30.22:47500..47509</value>
                                <value>192.168.30.99:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
        <property name="peerClassLoadingEnabled" value="true"/>
        <property name="userAttributes">
                <map>
                        <entry key="id" value="uno"/>
                 </map>
        </property>
    </bean>

We set it to cache configuration

     Ignition.setClientMode(true);
     ignite =
Ignition.getOrStart(Ignition.loadSpringBean("/home/hduser/apache-ignite-2.0.0-src/examples/config/example-cache1.xml",
"ignite.cfg"));
     CacheConfiguration<String,Long> cfg2=
Ignition.loadSpringBean("/home/hduser/apache-ignite-2.0.0-src/examples/config/example-cache1.xml",
"cacheconf");
-->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?

Thanks

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.
> NAML
> <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.
>

Mime
View raw message