Skip to content

Added FanOut/FanIn Pattern#1787

Merged
iluwatar merged 0 commit into
iluwatar:masterfrom
miqdigital:master
Jul 9, 2021
Merged

Added FanOut/FanIn Pattern#1787
iluwatar merged 0 commit into
iluwatar:masterfrom
miqdigital:master

Conversation

@karthikbhat13

@karthikbhat13 karthikbhat13 commented Jun 16, 2021

Copy link
Copy Markdown
Contributor

FanOut/FanIn Pattern

  • The pattern refers to executing multiple instances of the activity function on multiple chunks in parallel
  • Resolves Fan-Out/Fan-In pattern #1627

Pull request description

  • Added code that implements the design pattern and test cases

@iluwatar iluwatar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this pattern. Looks good in general. I added some improvement requests, please take a look and let us know when you're ready for another review.

Comment thread fanout-fanin/README.md Outdated
@@ -0,0 +1,33 @@
---
layout: pattern
title: FanOut-FanIn

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: FanOut-FanIn
title: Fan-Out/Fan-In

Comment thread fanout-fanin/README.md Outdated
title: FanOut-FanIn
folder: fanout-fanin
permalink: /patterns/fanout-fanin/
categories: Concurrency

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
categories: Concurrency
categories: Integration

Comment thread fanout-fanin/README.md Outdated
Comment on lines +9 to +10
- Cloud distributed
- Performance

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Cloud distributed
- Performance
- Microservices

Comment thread fanout-fanin/README.md Outdated
Comment on lines +14 to +20
The pattern that refers to executing multiple instances of the activity function concurrently. Generally "FanOut"
process is splitting the data into multiple chunks that would be passed to the activity function. "FanIn" process is
basically aggregating the result from individual instance of activity function and forming a single final result. <br />

Each activity function is a long-running process that takes in a chunk of data. A callback function, or a Consumer
is passed to the activity function, that will be called when the long-running process gets over. The consumer will
process the individual return value from activity function as they are done running into a final result.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term activity function is not self-explanatory. Could we perhaps talk about microservices?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also explain how the caller eventually gets the aggregated result.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need an explanation section and some of the details could be placed there.

Comment thread fanout-fanin/README.md Outdated
## Applicability

Use this pattern when you can chunk the workload or load into multiple chunks that can be dealt with separately.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could add a related patterns section, see https://github.com/iluwatar/java-design-patterns/wiki/02.-Pattern-template. Some of the microservices patterns we already have seemed to be quite similar.

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@iluwatar iluwatar merged commit 04bf566 into iluwatar:master Jul 9, 2021
@iluwatar

iluwatar commented Jul 9, 2021

Copy link
Copy Markdown
Owner

@karthikbhat13 I'm not sure what has happened, but the PR doesn't have any changed files anymore. Can you please take a look at it?

@karthikbhat13

Copy link
Copy Markdown
Contributor Author

Oh, didn't notice that. Lemme check. There is a hook to auto pull master branch to base repo. It probably replaced my branch. I will update again.

@karthikbhat13

Copy link
Copy Markdown
Contributor Author

@iluwatar Can I update this PR only to have the changes again? I can't figure it out. For now, I created one more PR, #1799

Let me know what I can do. Thanks

@iluwatar

iluwatar commented Jul 9, 2021

Copy link
Copy Markdown
Owner

@karthikbhat13 either way, but please ensure that you have addressed my earlier review comments.

@karthikbhat13

Copy link
Copy Markdown
Contributor Author

@karthikbhat13 either way, but please ensure that you have addressed my earlier review comments.

@iluwatar Have done that. I have fixed the comments and added the explanation and related patterns sections. 1948342 of #1799

@iluwatar

iluwatar commented Jul 9, 2021

Copy link
Copy Markdown
Owner

Ok, let's continue the process in #1799.

@karthikbhat13

Copy link
Copy Markdown
Contributor Author

Ok, let's continue the process in #1799.

@iluwatar There was the issue of pull bot again in this PR too. I have create a new one with custom branch, #1800. Please consider this whenever convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fan-Out/Fan-In pattern

2 participants