Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Handling bad message contents #12

Merged
merged 6 commits into from Mar 16, 2013

Conversation

Projects
None yet
2 participants
Owner

christav commented Mar 15, 2013

Fix for #8 and partially for #28. Detect and handle deserialization errors coming off service bus instead of crashing.

Logging of failure will come as part of logging work.

@andrerod andrerod commented on the diff Mar 16, 2013

lib/messagesequencer.js
@@ -27,6 +27,7 @@ function MessageSequencer(options, inner) {
this.pendingMessages = [];
inner.on('message', this.receiveMessage.bind(this));
+ inner.on('badmessage', this.receiveBadMessage.bind(this));
@andrerod

andrerod Mar 16, 2013

Should we use a better name ? Badmessage sounds weird..

@christav

christav Mar 16, 2013

Owner

I'm open to suggestions; I can't think of anything better at the moment.

@andrerod

andrerod Mar 18, 2013

could this be a generic error as well ? errormessage if not ?

@andrerod andrerod commented on the diff Mar 16, 2013

test/sequencing-tests.js
+
+ it('should ignore bad message in out of sequence messages', function () {
+ sendMessage('n1', 'msg', '0', 0);
+ sendMessage('n1', 'msg', '4', 4);
+ sendBadMessage('n1', 'msg', 1);
+ sendMessage('n1', 'msg', '2', 2);
+ sendBadMessage('n1', 'msg', 3);
+
+
+ receivedMessages.should.have.length(3);
+ [['n1', '0', 0], ['n1', '2', 2], ['n1', '4', 4]].forEach(function (testData, i) {
+ receivedMessages[i][0].should.equal(testData[0]);
+ receivedMessages[i][2].should.equal(testData[1]);
+ receivedMessages[i][3].should.equal(testData[2]);
+ });
+
@andrerod

andrerod Mar 16, 2013

remove uneeded new lines ?

@christav christav added a commit that referenced this pull request Mar 16, 2013

@christav christav Merge pull request #12 from christav/handle-parse-error-8
Handling bad message contents
1f7fe79

@christav christav merged commit 1f7fe79 into master Mar 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment