You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by rishi007bansod <ri...@gmail.com> on 2017/01/09 14:07:18 UTC

Update value in stream transformer

I want to update current value based on previous value in data streamer, so I
am using stream transformer. But initially when cache is empty I want to add
entries in cache(using same data streamer) as it is without update. In case
of stream transformer it provides initial null values. I want to get current
values initially and add them as it is. How can we do this?

(Since I have to update values after initial data insertion, hence I have
not considered stream visitor)




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Update-value-in-stream-transformer-tp9974.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Update value in stream transformer

Posted by vkulichenko <va...@gmail.com>.
I see what you're saying now. Streamed value is passed to your implementation
as an argument, so you can do smth like this:

stmr.receiver(new StreamTransformer<Integer, Long>() {
    @Override public Object process(MutableEntry<Integer, Long> e, Object...
args) {
        Object streamed = args[0];

        // Entry processor logic here.
    }
});

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Update-value-in-stream-transformer-tp9974p10001.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Update value in stream transformer

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

In general, you do not know what data has been stored in the cache and
which stay in the stream (it depends on the configuration of the flushing
and streamer capacity).
You can access the cache directly using cache.get (key), but in this case
part of the data may be in the stream.
Therefore, if you want to get the latest actual value, you need to perform
streamer.flust () or manually save values by key anywhere.

On Tue, Jan 10, 2017 at 7:54 AM, rishi007bansod <ri...@gmail.com>
wrote:

> But using entry processor we have to set value manually using e.setvalue()
> method, instead i want to store value from incoming stream as it is(since i
> don't know what data is in stream i cant set it manually). So how can we
> access current stream value in transformer instead of previous one?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Update-value-in-stream-transformer-tp9974p9985.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: Update value in stream transformer

Posted by rishi007bansod <ri...@gmail.com>.
But using entry processor we have to set value manually using e.setvalue()
method, instead i want to store value from incoming stream as it is(since i
don't know what data is in stream i cant set it manually). So how can we
access current stream value in transformer instead of previous one?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Update-value-in-stream-transformer-tp9974p9985.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Update value in stream transformer

Posted by vkulichenko <va...@gmail.com>.
If there is no value in cache yet, you can still set the new one in the
transformer (which is actually an entry processor). I'm not sure I
understand what is not working for you here, can you give an example?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Update-value-in-stream-transformer-tp9974p9979.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.