This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Integer implements Monoid<Integer> { | |
| public Integer empty() { | |
| return 1; | |
| } | |
| public Integer append(Integer other) { | |
| return this * other; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Integer implements Monoid<Integer> { | |
| public Integer empty() { | |
| return 0; | |
| } | |
| public Integer append(Integer other) { | |
| return this + other; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public <T extends Monoid<T>> Optional<T> concat(List<T> monoids) { | |
| return monoids.stream() | |
| reduce(Monoid::append); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class String implements Monoid<String> { | |
| @Override | |
| public String empty() { | |
| return ""; | |
| } | |
| @Override | |
| public String append(@NonNull String other) { | |
| return this + other; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Monoid<T extends Monoid<T>> { | |
| T empty(); | |
| T append(T other); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface MyService { | |
| void doWork(); | |
| } | |
| class MyServiceImpl implements MyService { | |
| @Override | |
| public void doWork() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ docker ps --all --filter label=type=secondary | |
| CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
| 1a2b8a308cf5 mybusybox "sh" 5 minutes ago Exited (0) 5 minutes ago mybusybox-container-3 | |
| 8bd0108e3fa8 mybusybox "sh" 5 minutes ago Exited (0) 5 minutes ago mybusybox-container-2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // setting the latch to 1 | |
| CountDownLatch transactionLatch = new CountDownLatch(1); | |
| // adding a node as the first node of the route | |
| AdviceWithRouteBuilder.adviceWith(camelContext, "queueRoute", context -> | |
| context.weaveAddFirst().process(exchange -> | |
| // adding transaction synchronization | |
| TransactionSynchronizationManager.registerSynchronization( | |
| new TransactionSynchronizationAdapter() { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TransactionSynchronizationManager.registerSynchronization( | |
| new TransactionSynchronizationAdapter() { | |
| @Override | |
| public void afterCommit() { | |
| // do something after transaction commit | |
| } | |
| })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AdviceWithRouteBuilder.adviceWith(camelContext, "queueRoute", context -> | |
| context.weaveAddFirst().process(exchange -> { | |
| // do something before exchange processing | |
| } | |
| ); |