Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
How to execute the Kafka Consumer file from Javascript

I have used KafkaJS library and configured an consumer code to fetch messages from a topic of one of my streaming API.

I have created a consumer.js file and I'm able to run the file from the location in the commandline using node consumer.js

But my requirement is to execute the consumer.js file from my javascript/cypress code. I have put the complete consumer.js code inside a method under a Class and tried to call but it fails.

Is there a way to run the node consumer.js command directly from the code OR else how can I call it from my class.

Tried the consumer code similar to this https://thecodebarbarian.com/getting-started-with-apache-kafka-in-node-js.html

Any help would be highly appreciated.

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

cy.exec() allows for execution of system commands. Note: there are some weird things to consider with this, that aren't readily apparent and could cause unexplained behaviors.

cy.exec('node consumer.js')
  // may be worthwhile to assert that the file ran successfully
  .its('code')
  .should('equal', 0);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!