How to invoke an action of its own service as soon as the service is up in moleculer js?

656 Views Asked by At

I am working in moleculer js, in which there is a requirement to call action/handler function of its own service to prepopulate the values from the DB and ecternal API call. If I do using started() method, service throwing below error.

[Runner] Service 'serviceName.actionName' is not found. ServiceNotFoundError: Service 'serviceName.actionName' is not found.

Could you share the beginner documentation/resources for reference? TIA

1

There are 1 best solutions below

0
On

The service can call its own actions via this.actions.myAction(params, opts). It's available before the service started/registered.