You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Coleman, JohnSteven (Agoda)" <Jo...@agoda.com> on 2019/04/05 12:46:01 UTC

Ingnite.Net ContinuousQuery

I'm trying to get a continuous query running to update an entry when its put in the cache with a 0 status.

A producer thread populates the cache, and this thread (code below*) should do the job but nothing happens, no listener or filter activity at all. I'm wondering if this task is even connected to the same cache instance? Where should computing logic for the continuous qry go, its same as the initialQry?

Thanks,
John

From https://github.com/JohnSColeman/IgniteDemo/blob/master/ConsoleApp1/FeeComputer.cs

     var eventListener = new EventListener();
            var qry = new ContinuousQuery<int, SimpleTransaction>(eventListener);
            var initialQry = new ScanQuery<int, SimpleTransaction>(new InitialFilter());
            using (var queryHandle = _cache.QueryContinuous(qry, initialQry))
            {
                foreach (var entry in queryHandle.GetInitialQueryCursor())
                {
                    var simpleTransaction = entry.Value;
                    ComputeFees(simpleTransaction);
                    simpleTransaction.EventStatus = 1;
                    _cache.Put(simpleTransaction.Id, simpleTransaction);
                    Console.WriteLine("computed: " + simpleTransaction);
                }
            }

________________________________
This message is confidential and is for the sole use of the intended recipient(s). It may also be privileged or otherwise protected by copyright or other legal rules. If you have received it by mistake please let us know by reply email and delete it from your system. It is prohibited to copy this message or disclose its content to anyone. Any confidentiality or privilege is not waived or lost by any mistaken delivery or unauthorized disclosure of the message. All messages sent to and from Agoda may be monitored to ensure compliance with company policies, to protect the company's interests and to remove potential malware. Electronic messages may be intercepted, amended, lost or deleted, or contain viruses.

Re: Ingnite.Net ContinuousQuery

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

I think you are going to close this Continuous Query when leaving using()
block, so it will not get any updates. Avoid closing ContinuousQuery while
it is needed.

Regards,
-- 
Ilya Kasnacheev


пт, 5 апр. 2019 г. в 15:46, Coleman, JohnSteven (Agoda) <
JohnSteven.Coleman@agoda.com>:

> I’m trying to get a continuous query running to update an entry when its
> put in the cache with a 0 status.
>
>
>
> A producer thread populates the cache, and this thread (code below*)
> should do the job but nothing happens, no listener or filter activity at
> all. I’m wondering if this task is even connected to the same cache
> instance? Where should computing logic for the continuous qry go, its same
> as the initialQry?
>
>
>
> Thanks,
>
> John
>
>
>
> From
> https://github.com/JohnSColeman/IgniteDemo/blob/master/ConsoleApp1/FeeComputer.cs
>
>
>
>      var eventListener = new EventListener();
>
>             var qry = new ContinuousQuery<int,
> SimpleTransaction>(eventListener);
>
>             var initialQry = new ScanQuery<int, SimpleTransaction>(new
> InitialFilter());
>
>             using (var queryHandle = _cache.QueryContinuous(qry,
> initialQry))
>
>             {
>
>                 foreach (var entry in queryHandle.GetInitialQueryCursor())
>
>                 {
>
>                     var simpleTransaction = entry.Value;
>
>                     ComputeFees(simpleTransaction);
>
>                     simpleTransaction.EventStatus = 1;
>
>                     _cache.Put(simpleTransaction.Id, simpleTransaction);
>
>                     Console.WriteLine("computed: " + simpleTransaction);
>
>                 }
>
>             }
>
> ------------------------------
> This message is confidential and is for the sole use of the intended
> recipient(s). It may also be privileged or otherwise protected by copyright
> or other legal rules. If you have received it by mistake please let us know
> by reply email and delete it from your system. It is prohibited to copy
> this message or disclose its content to anyone. Any confidentiality or
> privilege is not waived or lost by any mistaken delivery or unauthorized
> disclosure of the message. All messages sent to and from Agoda may be
> monitored to ensure compliance with company policies, to protect the
> company's interests and to remove potential malware. Electronic messages
> may be intercepted, amended, lost or deleted, or contain viruses.
>