Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda