README.md 1.69 KB
Newer Older
richardARPANET's avatar
richardARPANET committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# Task description:

- Create docker composition (docker-compose) of 2 microservices alongside a kafka image
- One service should produce messages, send to a Kafka topic
- The other service should be a consumer of that topic
- Message format doesn't matter
- Ideally the consumer should do something with the message (could just log it out )

Goal: I want to run docker-compose up, run a script (or tests ) and see the behavior in the console or the logs.

*2 python microservices alongside a kafka image
** Bonus points if the consumer service has a handler to either send messages to disk or to a datastore

Ideally, this should take no more than 3 hours.

Please share your code with me with detailed instructions on how to run. You can either share a private GitHub repo with me or send the code via email attachment.

-----

richardARPANET's avatar
richardARPANET committed
20 21 22 23
## Installation

First enter a virtual env and install `docker-compose` (`pip install docker-compose`).

richardARPANET's avatar
richardARPANET committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
## Run the tests

```bash
make test
```

## Running a demo

This demo will run two services:

- Patient tips service (generates tips for a patient)
- Patient notification service (reads those tips and sends a push notification to the patient). This will log out the fake action of making that push notification

Start kafka

```
make start-deps
```

Now in one terminal run:

```
make run_patient_tips_service
```

And in another

```
make run_patient_notification_service
```

richardARPANET's avatar
docs  
richardARPANET committed
55 56
In both terminals you will see the tips being sent (patient_tips_service) and then consumed and converted to a push notification by the other service (patient_notification_service).

richardARPANET's avatar
richardARPANET committed
57 58 59 60 61
## Future TODOs

- Deal with connection issues
- Deal with malformed messages
- More testing of unhappy paths
richardARPANET's avatar
docs  
richardARPANET committed
62 63
- Setup CI
- More docs