Skip to content

Commit 227715d

Browse files
committed
iluwatar#1627 adding readme
1 parent 9792eae commit 227715d

File tree

12 files changed

+37
-3
lines changed

12 files changed

+37
-3
lines changed

fanout-fanin/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
layout: pattern
3+
title: FanOut-FanIn
4+
folder: fanout-fanin
5+
permalink: /patterns/fanout-fanin/
6+
categories: Concurrency
7+
language: en
8+
tags:
9+
- Cloud distributed
10+
- Performance
11+
---
12+
13+
## Intent
14+
The pattern that refers to executing multiple instances of the activity function concurrently. Generally "FanOut"
15+
process is splitting the data into multiple chunks that would be passed to the activity function. "FanIn" process is
16+
basically aggregating the result from individual instance of activity function and forming a single final result. <br />
17+
18+
Each activity function is a long-running process that takes in a chunk of data. A callback function, or a Consumer
19+
is passed to the activity function, that will be called when the long-running process gets over. The consumer will
20+
process the individual return value from activity function as they are done running into a final result.
21+
22+
## Class diagram
23+
![alt-text](./etc/fanout-fanin.png)
24+
25+
## Applicability
26+
27+
Use this pattern when you can chunk the workload or load into multiple chunks that can be dealt with separately.
28+
29+
## Credits
30+
31+
* [Understanding Azure Durable Functions - Part 8: The Fan Out/Fan In Pattern](http://dontcodetired.com/blog/post/Understanding-Azure-Durable-Functions-Part-8-The-Fan-OutFan-In-Pattern)
32+
* [Fan-out/fan-in scenario in Durable Functions - Cloud backup example](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-cloud-backup)
33+
* [Understanding the Fan-Out/Fan-In API Integration Pattern](https://dzone.com/articles/understanding-the-fan-out-fan-in-api-integration-p)
File renamed without changes.
File renamed without changes.

fanin-fanout/pom.xml renamed to fanout-fanin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

12-
<artifactId>fanin-fanout</artifactId>
12+
<artifactId>fanout-fanin</artifactId>
1313

1414
<dependencies>
1515
<dependency>

fanin-fanout/src/main/java/com/iluwatar/fanout/fanin/App.java renamed to fanout-fanin/src/main/java/com/iluwatar/fanout/fanin/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
/**
12-
* FanOut/FanIn pattern is a behavioral pattern that refers to executing multiple instances of the
12+
* FanOut/FanIn pattern is a concurrency pattern that refers to executing multiple instances of the
1313
* activity function concurrently. The "fan out" part is essentially splitting the data into
1414
* multiple chunks and then calling the activity function multiple times, passing the chunks.
1515
*

fanin-fanout/src/main/java/com/iluwatar/fanout/fanin/FanOutFanIn.java renamed to fanout-fanin/src/main/java/com/iluwatar/fanout/fanin/FanOutFanIn.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static Long fanOutFanIn(
2424

2525
ExecutorService service = Executors.newFixedThreadPool(requests.size());
2626

27+
// fanning out
2728
List<CompletableFuture<Void>> futures =
2829
requests.stream()
2930
.map(

0 commit comments

Comments
 (0)