FAQ
Hello.

First of all, thanks Nathan and your team for storm. :)

Got a question about partitionPersist for trident topology.

In fact, I don't know where is the best place to update the DB with the
topology result.

Besides, the TestStateFactory seems to be useless. What I didn't saw ?

My first prototype is by using a code like:

topology processings
...

topology.join(streams, joinFields, JOIN_RESULT)
.partitionPersist(new TestStateFactory(), JOIN_RESULT, new
TestStateUpdater())

In the updateState of TestStateUpdater, I do the batch update to the DB.

The code in TestStateFactory:

public class TestStateFactory implements StateFactory {
private static final long serialVersionUID = 12345L;

public State makeState(@SuppressWarnings("rawtypes") Map conf, int
partitionIndex, int numPartitions) {
return new TestState(null, null);
}
}

TestState:

public class TestState extends TridentState implements State {
protected TestState(TridentTopology topology, Node node) {
super(topology, node);
}
}


Thanks for the answers.

JF

Search Discussions

  • JF Picard at Jan 2, 2013 at 4:04 pm
    Anyone can share some though about it ?

    Bump...
  • Wen Yang at Jan 5, 2013 at 6:37 am
    1. You should implement the multiPut and multiGet methods in your TestState
    class. The methods read/write data to databases.
    2. The TestStateFactory is called to make a state during the
    bolt initialization. This is transparent to you.
    3. You will need to implement the method updateState(State state, List
    tuples, TridentCollector collector) in your TestStateUpdater, where you can
    call state.multiGet and state.multiPut to read/write data to the database.
    On Thursday, January 3, 2013 12:04:41 AM UTC+8, JF Picard wrote:

    Anyone can share some though about it ?

    Bump...
  • JF Picard at Jan 7, 2013 at 8:53 pm
    Thanks for your answer.

    Why I can't just implement the method to write to database in updateState
    method by looping through the 'List tuples' of the method ? Is there any
    drawback ?

    What's the difference between using state.multiPut or updateState to update
    the database ?

    Also, since I use a spout to read from the database, to what state.multiGet
    is used for ?

    Thanks you very much.

    Le jeudi 3 janvier 2013 21:36:39 UTC-5, Wen Yang a écrit :
    1. You should implement the multiPut and multiGet methods in
    your TestState class. The methods read/write data to databases.
    2. The TestStateFactory is called to make a state during the
    bolt initialization. This is transparent to you.
    3. You will need to implement the method updateState(State state, List
    tuples, TridentCollector collector) in your TestStateUpdater, where you can
    call state.multiGet and state.multiPut to read/write data to the database.
    On Thursday, January 3, 2013 12:04:41 AM UTC+8, JF Picard wrote:

    Anyone can share some though about it ?

    Bump...

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupstorm-user @
postedDec 11, '12 at 8:17p
activeJan 7, '13 at 8:53p
posts4
users2
websitestorm-project.net
irc#storm-user

2 users in discussion

JF Picard: 3 posts Wen Yang: 1 post

People

Translate

site design / logo © 2022 Grokbase