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

Simultaneous pipelines does not work...last one wins? #25

Closed
nathanprobst opened this Issue Dec 16, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@nathanprobst

nathanprobst commented Dec 16, 2012

I have a need to process multiple files at once, each with it's own stream configuration. I'm new to NodeJS and EventStream, so I'm probably doing something dumb...but maybe not?

Here is a simplified version of my code...

for file in files
  console.log "Open file stream: #{file}"
  input = fs.createReadStream "#{PATH}#{file}"

  extractor = es.pipeline es.split(),
    es.map( (data, callback) ->   # callback(err, data)
...
          if (parsed) 
            return callback null, JSON.stringify(result) + '\n'  # pass along first match
      callback()  # drop data
    )
    es.map tapJSON

  console.log "Extracting facts from: #{file}"
  input.pipe extractor

The output I get only includes results from the last file...

Open file stream: EventLog_System.txt
Extracting facts from: EventLog_System.txt
Open file stream: EventLog_Application.txt
Extracting facts from: EventLog_Application.txt
{ category: 'VSS_ERROR',
  machine_name: 'Win7Pro-x64-VM1',
  date_time: '12/15/2012 3:07:00 PM',
  code: '22',
  none: 'None',
  error_message: 'Volume Shadow Copy Service error: A critical component required by the Volume Shadow Copy service is not registered.  This might happened if an error occurred during Windows setup or during installation of a Shadow Copy provider.  The error returned from CoCreateInstance on class with CLSID {e579ab5f-1cc4-44b4-bed9-de0991ff0623} and Name Coordinator is [0x80040154, Class not registered  ].    ' }

Reversing the order of files shows that the last pipeline wins.

Is it possible that the way event-stream, stream-combiner, duplex require eachother results in a singleton? I'm still looking, but I thought I'd ask the experts...

Nathan

@nathanprobst

This comment has been minimized.

nathanprobst commented Dec 16, 2012

Nevermind. I'm an idiot who doesn't understand closures...works perfectly. Thanks for the great tools!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment