Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access multiple tuples in Bolt #440

Open
Dcoder-D opened this issue Jul 5, 2018 · 0 comments
Open

How to access multiple tuples in Bolt #440

Dcoder-D opened this issue Jul 5, 2018 · 0 comments

Comments

@Dcoder-D
Copy link

Dcoder-D commented Jul 5, 2018

My topology in short is as follows:

from streamparse import Topology, Spout, Bolt, Stream


class Dataspout(Spout):
     outputs = [Stream(fields=['to_validate'], name='to_validate'),
                Stream(fields=['to_combine'],  name='to_combine')]

     def next_tuple(self):
          ###Does something
          self.emit(value_for_validate, stream='to_validate')
          self.emit(value_for_combine,  stream='to_combine')


class ValidateBolt(Bolt):
     outputs = [Stream(fields=['validated1', 'validated2'], name='validated')]

     def process(self, tup):
          ###Does something
          self.emit([a_list, b_list], stream='validated')     


class CombineBolt(Bolt):
     outputs = []
     
     def process(self, tup):
          """----------Highlight: My question is here-----------"""


class MyTopology(Topology):
     data_spout    = Dataspout.spec()
     validate_bolt = ValidateBolt.spec(inputs=[data_spout['to_validate']])
     combine_bolt  = CombineBolt.spec(inputs=[validate_bolt['validated'],
                                              data_spout['to_combine']]) 

Ideally, in the highlighted part I wish I could access the [a_list, b_list] emitted by validate_bolt and the value_for_combine emitted by data_spout in my combine_bolt. However, in the process(self, tup) function of CombineBolt, the tup.values only contains the tuple emitted by data_spout. (When I print out tup.values, it writes Data_Spoutto_validateTuple(to_validate=...) ) How could I access the tuple emitted by ValidationBolt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant