apache storm - Getting data from one database and process and store it to another database using trident topology -


i want data 1 database through spout , process data , store in database using trident.i new storm , trident , not sure how implement it.i got data database in spout(separate java class implements irichspout supported trident) , emit object.i need pass trident topology processing(counting number of records) , storing database.

 tridenttopology topology = new tridenttopology();    tridentstate wordcounts =           topology.newstream("spout1",spout) 

now new stream takes spout input i.e syntax is

 stream storm.trident.tridenttopology.newstream(string txid, irichspout spout) 

but want give object emitted spout input stream trident process , save database.so how can bring spout class inside trident , pass new stream or should combine both spout , trident same class??

can plz.....

you can like

    myfoospout spout = new myfoospout();     topology.newstream("spout1", spout).... 

where myfoospout class should implements irichspout

from trident tutorial newstream method in tridenttopology creates stream of data in topology reading input source.

in case myfoospout class

.i got data database in spout(separate java class implements irichspout supported trident) , emit object

can please clarify referring to? how spout code looks like? generic example if write (taken tutorial page)

    tridentstate wordcounts = topology.newstream("spout1", spout).each(new fields("sentence"), new split(), new fields("word")) 

it means spout supposed emit single field namely sentence. calling each split function applied each tuple in stream, perform based on whatever code written taking sentence field. vary depending on requirement. e.g filter myfilter extends basefilter or function mycustomfuction extends basefunction. check out api page more details.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -