|
6 | 6 |
|
7 | 7 | <br>
|
8 | 8 |
|
9 |
| -   |
| 9 | +   |
10 | 10 | 
|
11 | 11 |
|
12 | 12 | Choreography 방식으로 구현된 분산 트랜잭션 라이브러리 입니다.
|
@@ -146,24 +146,29 @@ _롤백은 TransactionRollbackEvent로 전달되는 `undo` 필드를 사용합
|
146 | 146 |
|
147 | 147 | ```kotlin
|
148 | 148 |
|
149 |
| -@TransactionStartHandler |
150 |
| -fun handleTransactionStartEvent(event: TransactionStartEvent) { |
151 |
| - // ... |
152 |
| -} |
| 149 | +@TransactionHandler |
| 150 | +class TransactionHandler { |
153 | 151 |
|
154 |
| -@TransactionJoinHandler |
155 |
| -fun handleTransactionJoinEvent(event: TransactionJoinEvent) { |
156 |
| - // ... |
157 |
| -} |
| 152 | + @TransactionStartListener(Foo::class) // Receive transaction event when event is Foo.class |
| 153 | + fun handleTransactionStartEvent(event: TransactionStartEvent) { |
| 154 | + val foo: Foo = event.decodeEvent(Foo::class) // Get event field to Foo.class |
| 155 | + // ... |
| 156 | + } |
158 | 157 |
|
159 |
| -@TransactionCommitHandler |
160 |
| -fun handleTransactionCommitEvent(event: TransactionCommitEvent) { |
161 |
| - // ... |
162 |
| -} |
| 158 | + @TransactionJoinHandler // Receive all transaction event when no type is defined. |
| 159 | + fun handleTransactionJoinEvent(event: TransactionJoinEvent) { |
| 160 | + // ... |
| 161 | + } |
| 162 | + |
| 163 | + @TransactionCommitHandler |
| 164 | + fun handleTransactionCommitEvent(event: TransactionCommitEvent): Mono<String> { // In Webflux framework, publisher must be returned. |
| 165 | + // ... |
| 166 | + } |
163 | 167 |
|
164 |
| -@TransactionRollbackHandler |
165 |
| -fun handleTransactionRollbackEvent(event: TransactionRollbackEvent) { |
166 |
| - // ... |
| 168 | + @TransactionRollbackHandler |
| 169 | + fun handleTransactionRollbackEvent(event: TransactionRollbackEvent) { // In Mvc framework, publisher must not returned. |
| 170 | + val undo: Foo = event.decodeUndo(Foo::class) // Get event field to Foo.class |
| 171 | + } |
167 | 172 | }
|
168 | 173 | ```
|
169 | 174 |
|
|
0 commit comments