You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "au.fp2018" <au...@gmail.com> on 2018/03/25 17:47:25 UTC

Cancelling a Continuous Query

Hello All,

What is the correct way to cancel a Continuous Query, and make sure all the
resources are used by the query are freed?

I looked in the documentation and the examples, I didn't see any explicit
reference to cancelling a running continuous query.

Thanks,
Andre



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cancelling a Continuous Query

Posted by "au.fp2018" <au...@gmail.com>.
Thanks Slava!

I had dropped the initial query from my continuous query, so I didn't look
in that direction. You are right it is clearly stated in the docs. 

Future reference for others, this works even if the inital query is not
specified. 
According to the docs:

    /Note that this works even if you didn't provide initial query. Cursor
will be empty in this case, but it will still unregister listeners when
QueryCursor.close() is called./

A classic case of RTFM :)



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Cancelling a Continuous Query

Posted by Вячеслав Коптилин <sl...@gmail.com>.
Hello Andre,

As mentioned in the javadoc [1], you have to call QueryCursor#close()
method in order to stop receiving updates.

    // Create new continuous query.
    ContinuousQuery<Long, Person> qry = new ContinuousQuery<>();
    // Execute query and get cursor that iterates through initial data.
    QueryCursor<Cache.Entry<Long, Person>> cur = cache.query(qry);
    ...
    // Stop receiving updates
    cur.close();

[1] https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/query/ContinuousQuery.html

[2] https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/query/QueryCursor.html


Thanks!


2018-03-25 20:47 GMT+03:00 au.fp2018 <au...@gmail.com>:

> Hello All,
>
> What is the correct way to cancel a Continuous Query, and make sure all the
> resources are used by the query are freed?
>
> I looked in the documentation and the examples, I didn't see any explicit
> reference to cancelling a running continuous query.
>
> Thanks,
> Andre
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>