Files
Spring Operator de71d4bffd URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* http://packages.confluent.io/maven/ (404) migrated to:
  https://packages.confluent.io/maven/ ([https](https://packages.confluent.io/maven/) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://www.apache.org/licenses/LICENSE-2.0 migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
* http://repo.spring.io/libs-milestone-local migrated to:
  https://repo.spring.io/libs-milestone-local ([https](https://repo.spring.io/libs-milestone-local) result 302).
* http://repo.spring.io/libs-release-local migrated to:
  https://repo.spring.io/libs-release-local ([https](https://repo.spring.io/libs-release-local) result 302).
* http://repo.spring.io/libs-snapshot-local migrated to:
  https://repo.spring.io/libs-snapshot-local ([https](https://repo.spring.io/libs-snapshot-local) result 302).
* http://repo.spring.io/release migrated to:
  https://repo.spring.io/release ([https](https://repo.spring.io/release) result 302).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0
* http://maven.apache.org/xsd/maven-4.0.0.xsd
* http://www.w3.org/2001/XMLSchema-instance
2019-03-21 15:21:19 -04:00
..
2019-03-21 15:21:19 -04:00
2019-03-21 15:21:19 -04:00
2018-08-09 10:37:31 -04:00
2019-03-21 15:19:50 -04:00
2018-08-09 10:37:31 -04:00

== Spring Cloud Stream Sample Transactional Application

This sample is showing how you can get a transactional producer using Kafka.

The flow is as follows

1. POST request with /<name> to :9997
2. transaction-http-source put on kafka topic person-event
3. transaction-spring-data-processor
a. listen to topic person-event
b. create new person entity and save to maria db
c. create a new person saved event and put on topic person-command
d. all this as a single transaction
4. transaction-logger-sink litsen to person-command and log out

=== How to start sample
Start kafka, zookeeper and mariaDb with `docker-compuse up -d` in this folder. 
Start each of the individual submodules in this project. Either in your IDE or by running `mvn spring:boot run` in each subfolder.
Send a POST request to localhost:9997

=== How to verify success and failure
Do a post request to localhost:9997 with a name field. This can be done with the following code using https://httpie.org[httpie]
```
http :9997 name=TonyStark
```
In the log for the sink application you will see that there is a PersonCreated event, the person is stored in the database.
Repeat the same command again and observe in the same log that there is not another PersonCreated event with the same name.

Look in the processor log and observe that the message is not removed from the queue since its transaction fails.

NB! Note that in a real world application you would have to handle unique constraint errors like this in the producers. Transaction failures like this are there to catch errors that you do not expect will happen, like network errors or similar scenarios. 

=== What properties makes this request transactional
 - Add @Transactional to method you want to be transactional and @EnableTransactional on the class
 - Configure the Producing application. 
```
spring.kafka.binder.transaction:
  transaction-id-prefix: person-
  producer:
    configuration:
      retries: 1
      acks: all
```

Transaction-id-prefix is required to start a transaction, The binder also requires setting retires to anything but 0 and set acks to all in order to enable transactions.

Note that consumers of the resulting topic should set issolation level to READ_COMMITED. This will not read messages that are on the topic but that is not commited.