== What is this app?

This is an example using Spring Cloud Stream to model a subset of a purchasing system. This e2e project showcases the following
features:

* Avro messaging
* Confluent Schema Registry
* Event-carried state transfer pattern
* KStream processing with a join operation

=== Running the app:

Start the Confluent Platform:

```
git clone https://github.com/confluentinc/cp-docker-images
cd cp-docker-images
git checkout 5.2.1-post
cd examples/cp-all-in-one/
docker-compose up -d --build
```

Go to the root of the sample project and do:

`./mvnw clean package`

`java -jar customer-service/target/customer-service-0.0.1-SNAPSHOT.jar`

`java -jar order-service/target/order-service-0.0.1-SNAPSHOT.jar`

`java -jar shipping-service/target/shipping-service-0.0.1-SNAPSHOT.jar`


Start two https://github.com/edenhill/kafkacat[kafkacat] processes to examine topic information:

```
kafkacat -b localhost:9092 -t customer -C \
  -f '\nKey (%K bytes): %k
  Value (%S bytes): %s
  Timestamp: %T
  Partition: %p
  Offset: %o
  Headers: %h\n'
```


```
kafkacat -b localhost:9092 -t order -C \
  -f '\nKey (%K bytes): %k
  Value (%S bytes): %s
  Timestamp: %T
  Partition: %p
  Offset: %o
  Headers: %h\n'
```

Create a customer:

`curl -X POST -H "content-type: application/json" http://localhost:8084/customers -d '{"id":1,"name":"John Doe","address":"Elm Street"}'`

Create an order for that customer:

`curl -X POST http://localhost:8085/orders -H "content-type: application/json" -d '{"id":1,"productId":100,"customerId":1}'`

Check the kafkacat output to verify that there is a record in the customer topic, and two in the order topic, corresponding
to the OrderCreatedEvent from customer-service and the OrderShippedEvent from shipping-service.

Customer topic kafkacat output:

```
Key (4 bytes):
  Value (26 bytes): John DoeElm Street
  Timestamp: 1561153134430
  Partition: 0
  Offset: 0
  Headers:

```

Order topic kafkacat output:

```
Key (4 bytes):
  Value (9 bytes): ?
  Timestamp: 1561153313512
  Partition: 0
  Offset: 0
  Headers:

Key (4 bytes):
  Value (28 bytes): ?John DoeElm Street
  Timestamp: 1561153313512
  Partition: 0
  Offset: 1
  Headers:

```
