Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bull
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 175
    • Issues 175
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OptimalBits
  • bull
  • Issues
  • #1067
Closed
Open
Issue created Sep 27, 2018 by Administrator@rootContributor

Communication between main process and sandboxed processors

Created by: alolis

Hello,

I am trying to figure out if there is a way to communicate from the processors with the main process (and vice versa) and send custom events. The reason is that I would like a processor to be able to emit events that the main process will be able to catch and do some side effects will the processor is still running. If everything was under the same process a custom EventEmitter would have been sufficient but unfortunately, this will not work with a sandboxed environment.

  1. From what I understand bull uses process.send and process.on in order to achieve communication between main process and the forked child processes. Is there a way to access the child.send method somehow from within the processor in order to send events to the parent while the main process waits with process.on?

  2. Would it be easier to refactor the job that is passed to the processor to be able to emit events via the underlying queue (which already inherits from EventEmitter) and to be able to do job.emit('custom-event', data) from within the processor and then on the main process queue.on('custom-event, handler)?

  3. Any other alternatives? I was thinking Redis pub/sub system since it's already there and I can use that for now if no other way via bull is possible at the moment.

Thank you for your time.

Assignee
Assign to
Time tracking