-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
1.adjust the ready function #246
Conversation
Hi, what's the issue you want to solve? Please add a proper description. |
I want to use hemera like the fastify framework, but in hemera, I can only use the registration of ready once, but not multiple times, so I can't nest the ready registration function internally when writing the hemera plugin. |
Could you make an example? |
` hemera.register(hemeraPlugin((h,opts,done)=>{ hemera.ready(()=>{ ` |
this._transport.driver.on('connect', () => { | ||
this.log.info('Connected!') | ||
|
||
this._isReadyWaits.forEach((readyCall)=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this doesn't work because you call _registerEvents
in the constructor. At that time no user has registered a ready callback handler.
this._transport.driver.on('disconnect', () => { | ||
this.log.warn('NATS disconnected!') | ||
}) | ||
// if (this._isReady) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments if you are done.
@@ -18,7 +18,9 @@ describe('Hemera', function() { | |||
const hemera = new Hemera(nats) | |||
hemera.ready(() => { | |||
try { | |||
hemera.ready() | |||
hemera.ready(()=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's that?
@@ -64,6 +64,7 @@ class Hemera { | |||
|
|||
this._root = this | |||
this._isReady = false | |||
this._isReadyWaits = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is
expresses a boolean value this is a list.
I have developed my own beanify microservice framework to replace Hemera |
Adjust the ready function to allow multiple registration callback functions