-
Notifications
You must be signed in to change notification settings - Fork 2
add ackOnMessageError #15
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,12 @@ const messageStatuses = { | |
|
|
||
|
|
||
| class Worker extends EventEmitter { | ||
| constructor(consumer, router) { | ||
| constructor(consumer, router, options = {}) { | ||
| super(); | ||
| this._consumer = consumer; | ||
| this.router = router; | ||
| this.router = router; | ||
| this.options = options; | ||
| if (_.isNil(this.options.ackOnMessageError)) this.options.ackOnMessageError = true; | ||
| } | ||
|
|
||
| get messageSchema() { | ||
|
|
@@ -61,6 +63,7 @@ class Worker extends EventEmitter { | |
| this.emit('message', { type: jsonMessage.type, status: messageStatuses.proceed }); | ||
| } catch (error) { | ||
| this.emit('error', error); | ||
| if (!this.options.ackOnMessageError) throw error; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its not clear from the name of the variable that you are going to throw an error
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the error is for cancelling the handling and send the message to sqs again, so queue-router will handle this message again next time
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this way i am "sending nack" |
||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.