Exemplo n.º 1
0
        /// <summary>
        /// No-arg constructor. Instantiates the continuous query and performs initial scan of elements that the remote filter
        /// will populate into the node-local groupers within the mutable grid.
        /// </summary>
        public TAGFileBufferQueueManager(bool runLocally)
        {
            _log.LogInformation("Establishing Ignite and TAG file buffer queue cache contexts");

            // Get the ignite grid and cache references
            _ignite = DIContext.Obtain <ITRexGridFactory>()?.Grid(StorageMutability.Mutable) ?? Ignition.GetIgnite(TRexGrids.MutableGridName());
            var queueCache    = _ignite.GetCache <ITAGFileBufferQueueKey, TAGFileBufferQueueItem>(TRexCaches.TAGFileBufferQueueCacheName());
            var handler       = new TAGFileBufferQueueItemHandler();
            var tagFileFilter = new RemoteTAGFileFilter(handler);

            _log.LogInformation("Creating continuous query");

            // Construct the continuous query machinery
            // Set the initial query to return all elements in the cache
            // Instantiate the queryHandle and start the continuous query on the remote nodes
            // Note: Only cache items held on this local node will be handled here
            _queryHandle = queueCache.QueryContinuous
                               (qry: new ContinuousQuery <ITAGFileBufferQueueKey, TAGFileBufferQueueItem>(new LocalTAGFileListener(handler))
            {
                Local  = runLocally,
                Filter = tagFileFilter
            },
                               initialQry: new ScanQuery <ITAGFileBufferQueueKey, TAGFileBufferQueueItem>
            {
                Local  = runLocally,
                Filter = tagFileFilter
            });

            // Perform the initial query to grab all existing elements and add them to the grouper
            // All processing should happen on the remote node in the implementation of the TAGFileFilter remote filter
            foreach (var item in _queryHandle.GetInitialQueryCursor())
            {
                _log.LogError(
                    $"A cache entry ({item.Key}) from the TAG file buffer queue was passed back to the local scan query rather than intercepted by the remote filter");
            }

            _log.LogInformation("Completed TAG file buffer queue manager initialization");
        }
Exemplo n.º 2
0
 public RemoteTAGFileFilter(TAGFileBufferQueueItemHandler handler)
 {
     this.handler = handler;
 }
Exemplo n.º 3
0
 public LocalTAGFileListener(TAGFileBufferQueueItemHandler handler)
 {
     this._handler = handler;
 }