|
| 1 | +<!DOCTYPE html> |
| 2 | +<html class="no-js" lang="en"> |
| 3 | + |
| 4 | +<head> |
| 5 | +<title>Words on API · Thoth</title> |
| 6 | +<meta charset="utf-8"/> |
| 7 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
| 8 | +<meta name="description" content='Thoth doc'/> |
| 9 | +<link href="https://fonts.googleapis.com/css?family=Roboto:100normal,100italic,300normal,300italic,400normal,400italic,500normal,500italic,700normal,700italic,900normal,900italicc" rel="stylesheet" type="text/css"/> |
| 10 | +<script type="text/javascript" src="lib/jquery/jquery.min.js"></script> |
| 11 | +<script type="text/javascript" src="js/page.js"></script> |
| 12 | +<script type="text/javascript" src="js/groups.js"></script> |
| 13 | +<link rel="stylesheet" type="text/css" href="lib/normalize.css/normalize.css"/> |
| 14 | +<link rel="stylesheet" type="text/css" href="lib/foundation/dist/foundation.min.css"/> |
| 15 | +<link rel="stylesheet" type="text/css" href="css/page.css"/> |
| 16 | + |
| 17 | +<!-- |
| 18 | +<link rel="shortcut icon" href="images/favicon.ico" /> |
| 19 | +--> |
| 20 | +</head> |
| 21 | + |
| 22 | +<body> |
| 23 | +<div class="off-canvas-wrapper"> |
| 24 | +<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper> |
| 25 | + |
| 26 | +<div class="off-canvas position-left" id="off-canvas-menu" data-off-canvas> |
| 27 | +<nav class="off-canvas-nav"> |
| 28 | +<div class="nav-home"> |
| 29 | +<a href="index.html" > |
| 30 | +<span class="home-icon">⌂</span>Thoth |
| 31 | +</a> |
| 32 | +<div class="version-number"> |
| 33 | +0.1.0* |
| 34 | +</div> |
| 35 | +</div> |
| 36 | +<select class="supergroup" name="Language"><option class="group" value="group-java">Java</option></select> |
| 37 | +<div class="nav-toc"> |
| 38 | +<ul> |
| 39 | + <li><a href="getting-started.html" class="page">Getting started</a></li> |
| 40 | + <li><a href="api.html" class="active page">Words on API</a></li> |
| 41 | + <li><a href="technical-considerations.html" class="page">Technical considerations</a></li> |
| 42 | + <li><a href="banking.html" class="page">In memory example</a></li> |
| 43 | + <li><a href="standard/index.html" class="page">Standard JOOQ/Kafka implementation</a> |
| 44 | + <ul> |
| 45 | + <li><a href="standard/banking-real-life.html" class="page">Postgres Kafka event sourcing</a></li> |
| 46 | + <li><a href="standard/projections.html" class="page">Projections</a></li> |
| 47 | + </ul></li> |
| 48 | + <li><a href="database-configuration.html" class="page">Database configuration</a></li> |
| 49 | + <li><a href="advanced/index.html" class="page">Advanced use cases</a> |
| 50 | + <ul> |
| 51 | + <li><a href="advanced/message.html" class="page">Warning / Info messages</a></li> |
| 52 | + <li><a href="advanced/event-ordering.html" class="page">Custom message ordering</a></li> |
| 53 | + <li><a href="advanced/aggregatestore.html" class="page">Aggregate store</a></li> |
| 54 | + <li><a href="advanced/event-replay.html" class="page">Event replay</a></li> |
| 55 | + <li><a href="advanced/multi-command.html" class="page">Multiple command handling in the same transaction</a></li> |
| 56 | + </ul></li> |
| 57 | + <li><a href="eventually-consistent-projection.html" class="page">Eventually consistent projections</a></li> |
| 58 | + <li><a href="kafka-consumption.html" class="page">Using published events</a></li> |
| 59 | + <li><a href="non-blocking/index.html" class="page">Non blocking JOOQ implementation</a> |
| 60 | + <ul> |
| 61 | + <li><a href="non-blocking/banking-real-life-non-blocking.html" class="page">Postgres Kafka, non blocking event sourcing</a></li> |
| 62 | + <li><a href="non-blocking/projections-non-blocking.html" class="page">Projections</a></li> |
| 63 | + </ul></li> |
| 64 | + <li><a href="resilient-kafka-consumption.html" class="page">Resilient kafka consumption</a></li> |
| 65 | +</ul> |
| 66 | +</div> |
| 67 | + |
| 68 | +</nav> |
| 69 | +</div> |
| 70 | + |
| 71 | +<div class="off-canvas-content" data-off-canvas-content> |
| 72 | + |
| 73 | +<header class="site-header expanded row"> |
| 74 | +<div class="small-12 column"> |
| 75 | +<a href="#" class="off-canvas-toggle hide-for-medium" data-toggle="off-canvas-menu"><svg class="svg-icon svg-icon-menu" version="1.1" id="Menu" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve"> <path class="svg-icon-menu-path" fill="#53CDEC" d="M16.4,9H3.6C3.048,9,3,9.447,3,10c0,0.553,0.048,1,0.6,1H16.4c0.552,0,0.6-0.447,0.6-1C17,9.447,16.952,9,16.4,9z M16.4,13 |
| 76 | +H3.6C3.048,13,3,13.447,3,14c0,0.553,0.048,1,0.6,1H16.4c0.552,0,0.6-0.447,0.6-1C17,13.447,16.952,13,16.4,13z M3.6,7H16.4 |
| 77 | +C16.952,7,17,6.553,17,6c0-0.553-0.048-1-0.6-1H3.6C3.048,5,3,5.447,3,6C3,6.553,3.048,7,3.6,7z"/></svg> |
| 78 | +</a> |
| 79 | +<div class="title-wrapper"> |
| 80 | +<div class="title-logo"></div> |
| 81 | +<div class="title"><a href="index.html">Thoth</a></div> |
| 82 | +</div> |
| 83 | +<!-- |
| 84 | +<a href="https://www.example.com" class="logo show-for-medium">logo</a> |
| 85 | +--> |
| 86 | +</div> |
| 87 | +</header> |
| 88 | + |
| 89 | +<div class="expanded row"> |
| 90 | + |
| 91 | +<div class="medium-3 large-2 show-for-medium column"> |
| 92 | +<nav class="site-nav"> |
| 93 | +<div class="nav-home"> |
| 94 | +<a href="index.html" > |
| 95 | +<span class="home-icon">⌂</span>Thoth |
| 96 | +</a> |
| 97 | +<div class="version-number"> |
| 98 | +0.1.0* |
| 99 | +</div> |
| 100 | +</div> |
| 101 | +<select class="supergroup" name="Language"><option class="group" value="group-java">Java</option></select> |
| 102 | +<div class="nav-toc"> |
| 103 | +<ul> |
| 104 | + <li><a href="getting-started.html" class="page">Getting started</a></li> |
| 105 | + <li><a href="api.html" class="active page">Words on API</a></li> |
| 106 | + <li><a href="technical-considerations.html" class="page">Technical considerations</a></li> |
| 107 | + <li><a href="banking.html" class="page">In memory example</a></li> |
| 108 | + <li><a href="standard/index.html" class="page">Standard JOOQ/Kafka implementation</a> |
| 109 | + <ul> |
| 110 | + <li><a href="standard/banking-real-life.html" class="page">Postgres Kafka event sourcing</a></li> |
| 111 | + <li><a href="standard/projections.html" class="page">Projections</a></li> |
| 112 | + </ul></li> |
| 113 | + <li><a href="database-configuration.html" class="page">Database configuration</a></li> |
| 114 | + <li><a href="advanced/index.html" class="page">Advanced use cases</a> |
| 115 | + <ul> |
| 116 | + <li><a href="advanced/message.html" class="page">Warning / Info messages</a></li> |
| 117 | + <li><a href="advanced/event-ordering.html" class="page">Custom message ordering</a></li> |
| 118 | + <li><a href="advanced/aggregatestore.html" class="page">Aggregate store</a></li> |
| 119 | + <li><a href="advanced/event-replay.html" class="page">Event replay</a></li> |
| 120 | + <li><a href="advanced/multi-command.html" class="page">Multiple command handling in the same transaction</a></li> |
| 121 | + </ul></li> |
| 122 | + <li><a href="eventually-consistent-projection.html" class="page">Eventually consistent projections</a></li> |
| 123 | + <li><a href="kafka-consumption.html" class="page">Using published events</a></li> |
| 124 | + <li><a href="non-blocking/index.html" class="page">Non blocking JOOQ implementation</a> |
| 125 | + <ul> |
| 126 | + <li><a href="non-blocking/banking-real-life-non-blocking.html" class="page">Postgres Kafka, non blocking event sourcing</a></li> |
| 127 | + <li><a href="non-blocking/projections-non-blocking.html" class="page">Projections</a></li> |
| 128 | + </ul></li> |
| 129 | + <li><a href="resilient-kafka-consumption.html" class="page">Resilient kafka consumption</a></li> |
| 130 | +</ul> |
| 131 | +</div> |
| 132 | + |
| 133 | +</nav> |
| 134 | +</div> |
| 135 | + |
| 136 | +<div class="small-12 medium-9 large-10 column"> |
| 137 | +<section class="site-content"> |
| 138 | + |
| 139 | +<div class="page-header row"> |
| 140 | +<div class="medium-12 show-for-medium column"> |
| 141 | +<div class="nav-breadcrumbs"> |
| 142 | +<ul> |
| 143 | + <li><a href="index.html">Thoth</a></li> |
| 144 | + <li>Words on API</li> |
| 145 | +</ul> |
| 146 | +</div> |
| 147 | +</div> |
| 148 | +</div> |
| 149 | + |
| 150 | +<div class="page-content row"> |
| 151 | +<div class="small-12 large-9 column" id="docs"> |
| 152 | +<h1><a href="#words-on-api" name="words-on-api" class="anchor"><span class="anchor-link"></span></a>Words on API</h1> |
| 153 | +<p>Thoth is non-blocking by default and rely on vavr but, you can choose if you use it or not. </p> |
| 154 | +<h2><a href="#basic-api" name="basic-api" class="anchor"><span class="anchor-link"></span></a>Basic API</h2> |
| 155 | +<p>The basic API use vavr for several reasons : * <code>Either</code> : to handle success or error * <code>Option</code> : instead of java Optional to handle missing values * <code>Tuple</code> : to collect data * <code>Tuple0</code> : to return values not handled (like Void but not exactly the same) * <code>List</code> : instead of java List, because the API is better * <code>Lazy</code> : for lazy values </p> |
| 156 | +<p>The basic API, is exposed with package <code>fr.maif.eventsourcing</code>. </p> |
| 157 | +<h2><a href="#vanilla-api" name="vanilla-api" class="anchor"><span class="anchor-link"></span></a>Vanilla API</h2> |
| 158 | +<p>If you don’t want to use vavr, there is a vanilla API : * <code>Either</code> -> <code>fr.maif.eventsourcing.Result</code>: a custom type to handle success or error * <code>Option</code> -> <code>Optional</code> * <code>Tuple</code> : internal * <code>Tuple0</code> -> <code>fr.maif.eventsourcing.Unit</code> : a custom type to return values not handled (like Void but not exactly the same) * <code>List</code> : -> <code>java.util.List</code><br/>* <code>Lazy</code> : for lazy values</p> |
| 159 | +<p>The package to use is <code>fr.maif.eventsourcing.vanilla</code> : * <code>AggregateStore</code> * <code>CommandHandler</code> * <code>EventHandler</code> * <code>EventProcessor</code> * <code>EventPublisher</code> * <code>Events</code> * <code>EventStore</code> * <code>ProcessingSuccess</code> * <code>Projection</code> * <code>SimpleCommand</code></p> |
| 160 | +<h2><a href="#blocking-api" name="blocking-api" class="anchor"><span class="anchor-link"></span></a>Blocking API</h2> |
| 161 | +<p>If you don’t to handle the non-blocking aspect, you can implement blocking interface, ie the blocking <code>CommandHandler</code>. </p> |
| 162 | +<p>The component to use * <code>fr.maif.eventsourcing.blocking.CommandHandler</code> : with standard API (vavr) * <code>fr.maif.eventsourcing.vanilla.blocking.CommandHandler</code> : with vanilla API</p> |
| 163 | +<h2><a href="#reactive-api-using-reactor" name="reactive-api-using-reactor" class="anchor"><span class="anchor-link"></span></a>Reactive API using reactor</h2> |
| 164 | +<p>There is a reactor API to use <code>Mono</code> instead of <code>CompletionStage</code>. The classes are prefixed with <code>Reactor</code> : * <code>ReactorAggregateStore</code> * <code>ReactorCommandHandler</code> * <code>ReactorEventProcessor</code> * <code>ReactorEventStore</code> * <code>ReactorPostgresKafkaEventProcessorBuilder</code> * <code>ReactorProjection</code> * <code>ReactorTransactionManager</code></p> |
| 165 | +<p>At the moment, the reactor API use vavr, there is no vanilla API. </p> |
| 166 | +<div class="nav-next"> |
| 167 | +<p><strong>Next:</strong> <a href="technical-considerations.html">Technical considerations</a></p> |
| 168 | +</div> |
| 169 | +</div> |
| 170 | +<div class="large-3 show-for-large column" data-sticky-container> |
| 171 | +<nav class="sidebar sticky" data-sticky data-anchor="docs" data-sticky-on="large"> |
| 172 | +<div class="page-nav"> |
| 173 | +<div class="nav-title">On this page:</div> |
| 174 | +<div class="nav-toc"> |
| 175 | +<ul> |
| 176 | + <li><a href="api.html#words-on-api" class="header">Words on API</a> |
| 177 | + <ul> |
| 178 | + <li><a href="api.html#basic-api" class="header">Basic API</a></li> |
| 179 | + <li><a href="api.html#vanilla-api" class="header">Vanilla API</a></li> |
| 180 | + <li><a href="api.html#blocking-api" class="header">Blocking API</a></li> |
| 181 | + <li><a href="api.html#reactive-api-using-reactor" class="header">Reactive API using reactor</a></li> |
| 182 | + </ul></li> |
| 183 | +</ul> |
| 184 | +</div> |
| 185 | +</div> |
| 186 | +</nav> |
| 187 | +</div> |
| 188 | +</div> |
| 189 | + |
| 190 | +</section> |
| 191 | +</div> |
| 192 | + |
| 193 | +</div> |
| 194 | + |
| 195 | +<footer class="site-footer"> |
| 196 | + |
| 197 | +<section class="site-footer-nav"> |
| 198 | +<div class="expanded row"> |
| 199 | +<div class="small-12 large-offset-2 large-10 column"> |
| 200 | +<div class="row site-footer-content"> |
| 201 | + |
| 202 | +<div class="small-12 medium-4 large-3 text-center column"> |
| 203 | +<div class="nav-links"> |
| 204 | +<ul> |
| 205 | +<!-- <li><a href="https://www.example.com/products/">Products</a> --> |
| 206 | +</ul> |
| 207 | +</div> |
| 208 | +</div> |
| 209 | + |
| 210 | +</div> |
| 211 | +</div> |
| 212 | +</div> |
| 213 | +</section> |
| 214 | + |
| 215 | +<section class="site-footer-base"> |
| 216 | +<div class="expanded row"> |
| 217 | +<div class="small-12 large-offset-2 large-10 column"> |
| 218 | +<div class="row site-footer-content"> |
| 219 | + |
| 220 | +<div class="small-12 text-center large-9 column"> |
| 221 | + |
| 222 | +<!-- |
| 223 | +<div class="copyright"> |
| 224 | +<span class="text">© 2025</span> |
| 225 | +<a href="https://www.example.com" class="logo">logo</a> |
| 226 | +</div> |
| 227 | +--> |
| 228 | +</div> |
| 229 | + |
| 230 | +</div> |
| 231 | +</div> |
| 232 | +</div> |
| 233 | +</section> |
| 234 | +</footer> |
| 235 | + |
| 236 | +</div> |
| 237 | +</div> |
| 238 | +</div> |
| 239 | +</body> |
| 240 | + |
| 241 | +<script type="text/javascript" src="lib/foundation/dist/foundation.min.js"></script> |
| 242 | +<script type="text/javascript">jQuery(document).foundation();</script> |
| 243 | +<script type="text/javascript" src="js/magellan.js"></script> |
| 244 | + |
| 245 | +<style type="text/css">@import "lib/prettify/prettify.css";</style> |
| 246 | +<script type="text/javascript" src="lib/prettify/prettify.js"></script> |
| 247 | +<script type="text/javascript" src="lib/prettify/lang-scala.js"></script> |
| 248 | +<script type="text/javascript">jQuery(function(){window.prettyPrint && prettyPrint()});</script> |
| 249 | +<script async src="https://www.googletagmanager.com/gtag/js?id=UA-112498312-1"></script> |
| 250 | +<script> |
| 251 | +window.dataLayer = window.dataLayer || []; |
| 252 | +function gtag(){dataLayer.push(arguments);} |
| 253 | +gtag('js', new Date()); |
| 254 | + |
| 255 | +gtag('config', 'UA-112498312-1'); |
| 256 | +</script> |
| 257 | +</html> |
| 258 | + |
| 259 | + |
| 260 | + |
| 261 | + |
0 commit comments