-
-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from tulios/eos-200-idempotent-producer
EoS #200 idempotent producer
- Loading branch information
Showing
14 changed files
with
799 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
module.exports = topicDataForBroker => { | ||
return topicDataForBroker.map(({ topic, partitions, messagesPerPartition }) => ({ | ||
topic, | ||
partitions: partitions.map(partition => ({ | ||
partition, | ||
messages: messagesPerPartition[partition], | ||
})), | ||
})) | ||
return topicDataForBroker.map( | ||
({ topic, partitions, messagesPerPartition, sequencePerPartition }) => ({ | ||
topic, | ||
partitions: partitions.map(partition => ({ | ||
partition, | ||
firstSequence: sequencePerPartition[partition], | ||
messages: messagesPerPartition[partition], | ||
})), | ||
}) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const createTopicData = require('./createTopicData') | ||
|
||
describe('Producer > createTopicData', () => { | ||
let topic, partitions, messagesPerPartition, sequencePerPartition | ||
|
||
beforeEach(() => { | ||
topic = 'test-topic' | ||
partitions = [1, 2, 3] | ||
|
||
messagesPerPartition = { | ||
1: [{ key: '1' }], | ||
2: [{ key: '2' }], | ||
3: [{ key: '3' }, { key: '4' }], | ||
} | ||
|
||
sequencePerPartition = { | ||
1: 0, | ||
2: 5, | ||
3: 10, | ||
} | ||
}) | ||
|
||
test('format data by topic and partition', () => { | ||
const result = createTopicData([ | ||
{ topic, partitions, messagesPerPartition, sequencePerPartition }, | ||
]) | ||
expect(result).toEqual([ | ||
{ | ||
topic, | ||
partitions: [ | ||
{ partition: 1, firstSequence: 0, messages: [{ key: '1' }] }, | ||
{ partition: 2, firstSequence: 5, messages: [{ key: '2' }] }, | ||
{ partition: 3, firstSequence: 10, messages: [{ key: '3' }, { key: '4' }] }, | ||
], | ||
}, | ||
]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.