You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Vladislav Pyatkov <vl...@gmail.com> on 2016/10/25 13:05:49 UTC

Re: Cant events listen from client Node

Hi,

If you want to handle EVT_CACHE_OBJECT_PUT from a client node, you need to
enable the event into configuration:

<bean class="org.apache.ignite.configuration.IgniteConfiguration">
...
<!-- Enable task execution events for examples. -->
    <property name="includeEventTypes">
        <list>
            ...
            <util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
        </list>
    </property>

For additional information look at the article[1].

[1]: https://apacheignite.readme.io/docs/events

On Tue, Oct 25, 2016 at 2:48 PM, Labard <da...@at-consulting.ru> wrote:

> Hello
> I have Ignite cluster and one client node.
> I want to listen "put into cache" events in my client node, but something
> does not work.
> If I use server node instead (just remove client property from config) it
> works exellent.
>
> My listener code:
>
> ignite.events(ignite.cluster().forCacheNodes(CTL_FILES)).
> remoteListen((uuid,
> evt) -> {
>             if (evt.cacheName().equals(CTL_FILES)) {
>                 final CTL_File value = (CTL_File) evt.newValue();
>                 if (value.getFileStatus().equals(TaskStatus.NEW)) {
>                     loadFile(value.getFileName(), count++,
> value.getFileTypeName() + "_TOPIC", ERROR_TOPIC);
>                 }
>             }
>             return true;
>         }, (IgnitePredicate<CacheEvent>) cacheEvent ->
> cacheEvent.cacheName().equals(CTL_FILES), EventType.EVT_CACHE_OBJECT_PUT);
>
> What's the problem?
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Cant-events-listen-from-client-Node-tp8470.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: Cant events listen from client Node

Posted by vkulichenko <va...@gmail.com>.
Hi,

You can always deserialize a BinaryObject by calling the deserialize()
method.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cant-events-listen-from-client-Node-tp8470p8519.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cant events listen from client Node

Posted by Labard <da...@at-consulting.ru>.
Hello.
Thank you for your help. I saw that problem was in my servers configs. Now I
enable event on all servers and start get events on client, but now i have
another problem.

In listener in event.newValue() I get BinaryObjectImpl and I want to get
value of my Class type.
How could I convert this?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cant-events-listen-from-client-Node-tp8470p8514.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cant events listen from client Node

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi

Could you please provide source code as example?

On Tue, Oct 25, 2016 at 4:18 PM, Labard <da...@at-consulting.ru> wrote:

> I have already enabled this event into configuration
>
>   <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>         <property name="clientMode" value="true"/>
>
>         <property name="peerClassLoadingEnabled" value="true"/>
>
>         <property name="includeEventTypes">
>             <util:constant
> static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
>         </property>
>
>         <property name="cacheConfiguration">
>             <list>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="CTL_FILES"/>
>                     <property name="cacheMode" value="REPLICATED"/>
>                     <property name="indexedTypes">
>                         <list>
>
> <value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File.Key</value>
>
> <value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File</value>
>                         </list>
>                     </property>
>                 </bean>
>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="CTL_FILE_TYPES"/>
>                     <property name="cacheMode" value="REPLICATED"/>
>                     <property name="indexedTypes">
>                         <list>
>
> <value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File_Type.Key</value>
>
> <value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File_Type</value>
>                         </list>
>                     </property>
>                 </bean>
>             </list>
>         </property>
>
> this work for server node but still does not work for client node.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Cant-events-listen-from-client-Node-tp8470p8472.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: Cant events listen from client Node

Posted by Labard <da...@at-consulting.ru>.
I have already enabled this event into configuration

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

        <property name="clientMode" value="true"/>

        <property name="peerClassLoadingEnabled" value="true"/>

        <property name="includeEventTypes">
            <util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
        </property>

        <property name="cacheConfiguration">
            <list>
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="CTL_FILES"/>
                    <property name="cacheMode" value="REPLICATED"/>
                    <property name="indexedTypes">
                        <list>
                           
<value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File.Key</value>
                           
<value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File</value>
                        </list>
                    </property>
                </bean>

                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="CTL_FILE_TYPES"/>
                    <property name="cacheMode" value="REPLICATED"/>
                    <property name="indexedTypes">
                        <list>
                           
<value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File_Type.Key</value>
                           
<value>ru.at_consulting.dmp.vip.georgia.ignite.CTL_File_Type</value>
                        </list>
                    </property>
                </bean>
            </list>
        </property>

this work for server node but still does not work for client node.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cant-events-listen-from-client-Node-tp8470p8472.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.