ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svonn <sveng...@posteo.de>
Subject Re: How to do 'stream processing' and more questions of a Ignite newbie
Date Fri, 22 Dec 2017 12:50:48 GMT
Hi,

Thanks alot!
I managed to finally get my interpolation up an running.

Most of my questions were caused by confusing due to weird peer class
loading errors. 
The errors I encountered while having peer class loading enabled apparently
were caused by classes not getting redeployed on the ignite nodes. Hence, I
kept runnining into the very same errors despite editing the code. From what
I've read at 
https://apacheignite.readme.io/docs/deployment-modes
it should work with the standard 'shared' mode, so I'm not quite sure why it
didn't update the classes. 
I'll do some further testing with 'continuous mode', as of now I need to
restart my nodes to redeploy the class.

For now, my only question left is following thing:

Here's a method from my class:

Ignition.setClientMode(true);
        Ignite ignite = Ignition.ignite();
        IgniteCache<BinaryObject, BinaryObject> accCache =
Ignition.ignite().cache("AccelerationPoint").withKeepBinary();

(1)        double interpolationProgress = ((double)
(accPoint.getKey().<Long>field("timestamp") -
prevGps.<Long>field("timestamp"))) / ((double)
(curGps.<Long>field("timestamp") - prevGps.<Long>field("timestamp")));
        double interpolatedLat = prevGps.<Double>field("lat") +
interpolationProgress * (curGps.<Double>field("lat") -
prevGps.<Double>field("lat"));
        double interpolatedLon = prevGps.<Double>field("lon") +
interpolationProgress * (curGps.<Double>field("lon") -
prevGps.<Double>field("lon"));
 
(2)       System.out.println("Previous lat: " + prevGps.<Double>field("lat")
+ " ; Interpolated lat: " + interpolatedLat + " ; Next lat: " +
curGps.<Double>field("lat"));


(3)        accCache.<BinaryObject, BinaryObject>withKeepBinary().invoke(
                accPoint.getKey(), new CacheEntryProcessor<BinaryObject,
BinaryObject, Object>() {
                    public Object process(MutableEntry<BinaryObject,
BinaryObject> entry,
                                          Object... objects) throws
EntryProcessorException {
                        // Create builder from the old value.
                        BinaryObjectBuilder bldr =
entry.getValue().toBuilder();

                        //Update the field in the builder.
                        bldr.setField("lat", interpolatedLat);
                        bldr.setField("lon", interpolatedLon);

                        // Set new value to the entry.
                        entry.setValue(bldr.build());

                        return null;
                    }
                });

I'm still trying to grasp how Ignite 'decides' to run the code.
For (3) I know that it's run directly on the ignite node. (2) Is printed in
my IDE, thus it has to be executed on the client node.
Where is (2) being calculated? If its on the client node, whats the best way
to transfer that processing to the nodes? If it's on the nodes already, how
does it 'know' where to do it?

Best regards and thanks alot for the help!
Svonn




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

Mime
View raw message