Skip to content

Instantly share code, notes, and snippets.

@m0mus
Last active June 15, 2020 06:11
Show Gist options
  • Save m0mus/ba6c5419278239a19175445787420736 to your computer and use it in GitHub Desktop.
Save m0mus/ba6c5419278239a19175445787420736 to your computer and use it in GitHub Desktop.
Homework

Stream Combiner

Description

Stream Combiner is an application that allows you to create a combined stream. This stream combines / merges entries from all (original) individual streams.

Requirements

  1. Application should be configurable to read data from N hosts:ports.
  2. Input streams provide data in XML format.
  • Data in input stream could be veeery LARGE.
  • Data in input stream is sorted by timestamp.
  1. Application output is JSON stream.
  2. Output data should be sorted by timestamp.
  3. If several inputs provide data with the same timestamp - amounts should be merged.
  4. Amounts could be positive/negative. And it's very sensitive data - like money. And nobody likes losing money.
  5. For extra bonus points:
  • add solution in case if some input streams hang.
  • imagine that timestamps comparing operation is VERY expensive - try to minimize it's usage.

Implementation

  1. Project lifecycyle:
  • You must use Maven 3.x to build the project.
  • You must use JUnit to write tests for the project. Use of any JUnit extensions is allowed.
  1. Definition of XML format:
    <data> <timestamp>123456789</timeStamp> <amount>1234.567890</amount> </data>
  2. XMLs in stream are separated by new line (\n)
  3. Definition of JSON format:
    { "data": { "timestamp":123456789, "amount":"1234.567890" }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment