-
Notifications
You must be signed in to change notification settings - Fork 1
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
adds reenqueue by name processor #9
Conversation
test/deadLetterProcessors.js
Outdated
@@ -56,6 +56,30 @@ describe('Deadletter processors', function() { | |||
}); | |||
}); | |||
|
|||
// eslint-disable-next-line |
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.
why is this needed?
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.
long story short, it's not needed.
long story long: i thought it was jasmine so I was using fdescribe. little did I know it was mocha (also these tests are FAST)
@@ -0,0 +1,12 @@ | |||
const deadletterActions = require('./../deadletterActions'); |
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.
minor reenqueueAllByName
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 thought about it but seemed misleading. so I removed the All
although I can be argued eitherways. don't feel too strongly about it.
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.
nope, its a minor comment
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.
two small comments, thoughts?
0800848
to
336df0e
Compare
@earobinson - updated with less |
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.
some minor nitpicking
if (event === content.event) { | ||
return Q.when(deadletterActions.REENQUEUE_MESSAGE); | ||
} else { | ||
return Q.reject(new Error(`Required ${event} does not match ${message.content.event}`)); |
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.
not sure we need Q
for these, should be able to use native promises
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.
while I agree with that and I'd use native as much as possible, but I'm not sure (maybe I'm unaware) of a Q.when()
implementation in the Promise prototype.
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.
in this case the parameter is just a string so Promise.resolve()
could work? i find the when
method mysterious indeed
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.
since I'm not sure if a Promise.resolve
would work, I'd suggest in the interest of consistency, we can go with the Q
library.
however, I'm up to investigate the Promise.resolve
as a separate issue so that we can switch all the deadletterProcessors
to use native promises and remove the dependency on Q
#winwin
what do you think @iain8 ?
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.
@iain8 is correct Promise.resolve()
would work, it's up to you how much you want to scout this.
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.
@earobinson @iain8 - I've created an issue for this #10 in order to properly investigate this.
since the Q
implementation is in step with the rest of the library, I think investigating it is definitely beneficial to reduce unnecessary dependencies, however outside of the scope of this PR.
test/deadLetterProcessors.js
Outdated
describe('Re-Enqueue by Name Processor', function() { | ||
|
||
it('should return with a promise containing requeue all messages action when the event name matches', function() { | ||
const testScope = this; |
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 don't feel that aliasing the scope is necessary for using it in these tests
const Q = require('q'); | ||
|
||
module.exports = function(event, message) { | ||
const content = JSON.parse(message.content); |
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.
parse()
will throw a cheeky error if the message content isn't valid JSON, will this be handled gracefully by the library?
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.
in this context iirc the message is guaranteed to be valid json, also this would just cause our commandline app to crash
336df0e
to
a2a9205
Compare
We need a way to process large number of deadletter events by filtering specific events.
This processor just takes an event name as a property and enqueues matching events.