Skip to content

Commit e0ef56e

Browse files
[CI] Publish Preview for PR #1 05852c2
1 parent 472fee0 commit e0ef56e

File tree

4 files changed

+40
-34
lines changed

4 files changed

+40
-34
lines changed

pull-1/sitemap.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33
<url>
44
<loc>https://redhat-solution-patterns.github.io/solution-patterns/solution-pattern-event-mesh-for-microservices/01-pattern.html</loc>
5-
<lastmod>2025-03-26T18:22:49.683Z</lastmod>
5+
<lastmod>2025-03-27T19:54:07.209Z</lastmod>
66
</url>
77
<url>
88
<loc>https://redhat-solution-patterns.github.io/solution-patterns/solution-pattern-event-mesh-for-microservices/02-architecture.html</loc>
9-
<lastmod>2025-03-26T18:22:49.683Z</lastmod>
9+
<lastmod>2025-03-27T19:54:07.209Z</lastmod>
1010
</url>
1111
<url>
1212
<loc>https://redhat-solution-patterns.github.io/solution-patterns/solution-pattern-event-mesh-for-microservices/03-demo.html</loc>
13-
<lastmod>2025-03-26T18:22:49.683Z</lastmod>
13+
<lastmod>2025-03-27T19:54:07.209Z</lastmod>
1414
</url>
1515
<url>
1616
<loc>https://redhat-solution-patterns.github.io/solution-patterns/solution-pattern-event-mesh-for-microservices/developer-resources.html</loc>
17-
<lastmod>2025-03-26T18:22:49.683Z</lastmod>
17+
<lastmod>2025-03-27T19:54:07.209Z</lastmod>
1818
</url>
1919
<url>
2020
<loc>https://redhat-solution-patterns.github.io/solution-patterns/solution-pattern-event-mesh-for-microservices/index.html</loc>
21-
<lastmod>2025-03-26T18:22:49.683Z</lastmod>
21+
<lastmod>2025-03-27T19:54:07.209Z</lastmod>
2222
</url>
2323
</urlset>

pull-1/solution-pattern-event-mesh-for-microservices/02-architecture.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ <h3 id="_event_mesh_flow"><a class="anchor" href="#_event_mesh_flow"></a><a clas
293293
<div class="olist arabic">
294294
<ol class="arabic">
295295
<li>
296-
<p>An end-user application sends an <em>HTTP</em> request to the <em>Event Mesh</em>. Such message can be understood as a <em>Command</em> type event.</p>
296+
<p>An end-user application sends an <em>HTTP</em> request to the <em>Event Mesh</em>.
297+
Such message can be understood as a <em>Command</em> type event.</p>
297298
</li>
298299
<li>
299300
<p>The <em>Event Mesh</em> (Broker) persists the event in a queue (like an Apache Kafka topic, but the implementation is hidden from the user).

pull-1/solution-pattern-event-mesh-for-microservices/03-demo.html

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ <h2 id="_demonstration"><a class="anchor" href="#_demonstration"></a><a class="l
156156
<div class="sectionbody">
157157
<div class="paragraph">
158158
<p>Let&#8217;s take a look at the following example.
159-
We&#8217;ll be looking at a Cabs ride-sharing application, that mimics real-world solutions of similar kind.
159+
We&#8217;ll be looking at a Cabs ride-sharing application, that resembles real-world solutions of similar kind.
160160
The application is written in a popular Java framework.</p>
161161
</div>
162162
<div class="sect2">
@@ -189,18 +189,19 @@ <h3 id="_initial_application"><a class="anchor" href="#_initial_application"></a
189189
}
190190
Address from = addressRepository.getByHash(transitDetails.from.getHash());
191191
Address to = addressRepository.getByHash(destinationAddress.getHash());
192+
192193
Money finalPrice = completeTransitService.completeTransit(
193194
driverId, requestUUID, from, to); <i class="conum" data-value="2"></i><b>(2)</b>
194-
Money driverFee = driverFeeService.calculateDriverFee(
195-
finalPrice, driverId);
195+
Money driverFee = driverFeeService.calculateDriverFee(finalPrice, driverId);
196196
driverService.markNotOccupied(driverId); <i class="conum" data-value="2"></i><b>(2)</b>
197-
transitDetailsFacade.transitCompleted(requestUUID,
198-
Instant.now(clock), finalPrice, driverFee); <i class="conum" data-value="2"></i><b>(2)</b>
199-
awardsService.registerMiles(transitDetails.client.getId(),
200-
transitDetails.transitId); <i class="conum" data-value="2"></i><b>(2)</b>
197+
198+
transitDetailsFacade.transitCompleted(requestUUID, Instant.now(clock),
199+
finalPrice, driverFee); <i class="conum" data-value="2"></i><b>(2)</b>
200+
awardsService.registerMiles(transitDetails.client.getId(), transitDetails.transitId); <i class="conum" data-value="2"></i><b>(2)</b>
201201
invoiceGenerator.generate(finalPrice.toInt(),
202202
transitDetails.client.getName() + " " +
203203
transitDetails.client.getLastName()); <i class="conum" data-value="2"></i><b>(2)</b>
204+
204205
eventsEventSender.publish(new TransitCompleted(
205206
transitDetails.client.getId(), transitDetails.transitId,
206207
transitDetails.from.getHash(), destinationAddress.getHash(),
@@ -309,19 +310,22 @@ <h4 id="_drivers_module"><a class="anchor" href="#_drivers_module"></a><a class=
309310
<div class="content">
310311
<pre class="highlightjs highlight"><code class="language-rust hljs" data-lang="rust">impl Service {
311312
pub async fn calculate_fee(&amp;mut self, ce: Event) -&gt; Result&lt;()&gt; {
312-
let fee_event = Self::parse_fee_event(ce)?; <i class="conum" data-value="1"></i><b>(1)</b>
313-
let subject = fee_event.id.clone();
313+
let calc_fee_intent = Self::unwrap_calculatefee(ce)?; <i class="conum" data-value="1"></i><b>(1)</b>
314+
let subject = calc_fee_intent.id.clone();
315+
316+
log::debug!("calculate fee for: {:?}", calc_fee_intent);
317+
let drv = self.repo.get(&amp;calc_fee_intent.entity.driver_id).await?;
314318

315-
let drv = self.repo.get(&amp;fee_event.entity.driver_id).await?;
319+
let fee = drv.calculate_fee(&amp;calc_fee_intent.entity.transit_price); <i class="conum" data-value="2"></i><b>(2)</b>
316320

317-
let fee = drv.calculate_fee(&amp;fee_event.entity.transit_price); <i class="conum" data-value="2"></i><b>(2)</b>
321+
log::debug!("fee value: {:?}", fee);
318322

319-
let fee_event = DriverFeeEvent {
320-
driver_id: fee_event.entity.driver_id,
323+
let driverfee_event = DriverFeeEvent {
324+
driver_id: calc_fee_intent.entity.driver_id,
321325
fee,
322326
}; <i class="conum" data-value="3"></i><b>(3)</b>
323327

324-
let mut builder = fee_event.to_builder(); <i class="conum" data-value="3"></i><b>(3)</b>
328+
let mut builder = driverfee_event.to_builder(); <i class="conum" data-value="3"></i><b>(3)</b>
325329
if let Some(id) = subject {
326330
builder = builder.subject(id);
327331
} <i class="conum" data-value="3"></i><b>(3)</b>
@@ -342,19 +346,19 @@ <h4 id="_drivers_module"><a class="anchor" href="#_drivers_module"></a><a class=
342346
<table>
343347
<tr>
344348
<td><i class="conum" data-value="1"></i><b>1</b></td>
345-
<td>We are parsing the internal, business logic, fee event from the <em>Cloud Events</em> envelope.</td>
349+
<td>We are unwrapping <em>Cloud Event</em> envelope into an internal, domain, fee value object.</td>
346350
</tr>
347351
<tr>
348352
<td><i class="conum" data-value="2"></i><b>2</b></td>
349-
<td>We are calculating the fee for this event, using some business logic.</td>
353+
<td>We are calculating the fee value using some domain logic.</td>
350354
</tr>
351355
<tr>
352356
<td><i class="conum" data-value="3"></i><b>3</b></td>
353-
<td>We are wrapping the calculated fee into the <em>Cloud Events</em> envelope.</td>
357+
<td>We are wrapping the calculated fee value into a new <em>Cloud Event</em>.</td>
354358
</tr>
355359
<tr>
356360
<td><i class="conum" data-value="4"></i><b>4</b></td>
357-
<td>We are sending the fee back to the <em>Event Mesh</em> using <em>HTTP REST</em> client.</td>
361+
<td>We are sending the fee, as <em>Cloud Event</em>, back to the <em>Event Mesh</em> using <em>HTTP REST</em> client.</td>
358362
</tr>
359363
</table>
360364
</div>
@@ -489,7 +493,7 @@ <h4 id="_event_mesh"><a class="anchor" href="#_event_mesh"></a><a class="link" h
489493
</td>
490494
<td class="content">
491495
<div class="paragraph">
492-
<p>The policy is <code>exponential</code>, and the <code>retry</code> is 10, which means that after approximately 6 min and 50 sec the event will be dropped.</p>
496+
<p>In our example, the policy is <code>exponential</code>, and the <code>retry</code> is 10, which means that after approximately 6 min and 50 sec the event will be dropped (or routed to the <code>deadLetterSink</code> if configured).</p>
493497
</div>
494498
</td>
495499
</tr>
@@ -504,7 +508,7 @@ <h4 id="_event_mesh"><a class="anchor" href="#_event_mesh"></a><a class="link" h
504508
<td class="content">
505509
<div class="paragraph">
506510
<p>A <code>deadLetterSink</code> option could be configured for the <em>Broker</em> to send the events that failed to be delivered in time to a back-up location.
507-
Events captured in a back-up location can be re-transmitted into the <em>Event Mesh</em> later.</p>
511+
Events captured in a back-up location can be re-transmitted into the <em>Event Mesh</em> later by reconfiguring the <em>Mesh</em> (after resolving the outage or deploying a bug fix).</p>
508512
</div>
509513
</td>
510514
</tr>
@@ -555,7 +559,7 @@ <h4 id="_legacy_application_changes"><a class="anchor" href="#_legacy_applicatio
555559
</tr>
556560
<tr>
557561
<td><i class="conum" data-value="2"></i><b>2</b></td>
558-
<td>We are using the <code>@EventListener</code> annotation to listen for the business events withing the applition.
562+
<td>We are using the <code>@EventListener</code> annotation to listen for the domain events within the application.
559563
Don&#8217;t confuse this with <em>Cloud Events</em> that are sent and received outside the application.</td>
560564
</tr>
561565
<tr>
@@ -569,7 +573,7 @@ <h4 id="_legacy_application_changes"><a class="anchor" href="#_legacy_applicatio
569573
</table>
570574
</div>
571575
<div class="paragraph">
572-
<p>To make it work, we need to add a new <em>Cloud Event</em> sender and listener.
576+
<p>To communicate with the <em>Event Mesh</em>, we need to add a new <em>Cloud Event</em> sender and listener.
573577
That&#8217;s being done similarly, as in the case of <em>Rust</em> application.</p>
574578
</div>
575579
<div class="paragraph">
@@ -686,12 +690,12 @@ <h4 id="_legacy_application_changes"><a class="anchor" href="#_legacy_applicatio
686690
<table>
687691
<tr>
688692
<td><i class="conum" data-value="1"></i><b>1</b></td>
689-
<td>We unwrap the <em>CloudEvent</em> into our custom event type</td>
693+
<td>We unwrap the <em>CloudEvent</em> into our domain event type (in the example that&#8217;s the <code>DriverFeeCalculated</code> type)</td>
690694
</tr>
691695
<tr>
692696
<td><i class="conum" data-value="2"></i><b>2</b></td>
693697
<td>And publish it withing the application, using the framework&#8217;s <em>EventsPublisher</em> implementation.
694-
The event will be transmitted to the methods annotated with <code>@EventListener</code>.</td>
698+
The domain events will be transmitted to the methods annotated with <code>@EventListener</code>.</td>
695699
</tr>
696700
</table>
697701
</div>
@@ -703,7 +707,7 @@ <h4 id="_legacy_application_changes"><a class="anchor" href="#_legacy_applicatio
703707
</td>
704708
<td class="content">
705709
<div class="paragraph">
706-
<p>Don&#8217;t confuse the the framework&#8217;s <em>EventsPublisher</em> with <em>Cloud Event</em> sender and receiver.</p>
710+
<p>Don&#8217;t confuse the framework&#8217;s <em>EventsPublisher</em> with <em>Cloud Event</em> sender and receiver.</p>
707711
</div>
708712
</td>
709713
</tr>
@@ -1117,7 +1121,8 @@ <h4 id="_configuring_the_event_mesh"><a class="anchor" href="#_configuring_the_e
11171121
</div>
11181122
<div class="paragraph">
11191123
<p>The console shows two sink bindings on the left, and they are feeding the events from the applications to the <em>Broker</em> (depicted in the center).
1120-
on the right, you could see the two applications deployed as <em>Knative</em> services, and two triggers (as lines) that configure the <em>Event Mesh</em> to feed appropriate events to the applications.</p>
1124+
The <em>Broker</em> is the centralized infrastructure piece that ensures a proper decoupling of the services.
1125+
On the right, you could see the two applications deployed as <em>Knative</em> services, and two triggers (as lines) that configure the <em>Event Mesh</em> to feed appropriate events to the applications.</p>
11211126
</div>
11221127
</div>
11231128
</div>

pull-1/solution-pattern-event-mesh-for-microservices/developer-resources.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ <h2 id="_developer_resources"><a class="anchor" href="#_developer_resources"></a
155155
<div class="ulist">
156156
<ul>
157157
<li>
158-
<p><a href="https://github.com/cardil/cabs-usvc">Demo Source</a> <em>(The example code used in this solution)</em></p>
158+
<p><a href="https://github.com/cardil/cabs-usvc">Demo source code</a> &mdash; <em>The example code used in this solution, based on the <a href="https://github.com/legacyfighter/cabs-java">LegacyFighter Java app</a></em></p>
159159
</li>
160160
<li>
161-
<p><a href="https://youtu.be/Rc5IO6S6ZOk">youtu.be / Rc5IO6S6ZOk</a> <em>(The talk that served a base for this solution)</em></p>
161+
<p><a href="https://youtu.be/Rc5IO6S6ZOk">Let&#8217;s get meshy! Microservices are easy with Event Mesh</a> &mdash; <em>The talk that served a base for this solution</em></p>
162162
</li>
163163
<li>
164164
<p><a href="https://www.redhat.com/en/technologies/cloud-computing/openshift/serverless">Red Hat OpenShift Serverless</a></p>

0 commit comments

Comments
 (0)