Skip to main content
Async Method Invocation

Intent

Asynchronous method invocation is a pattern where the calling thread is not blocked while waiting results of tasks. The pattern provides parallel processing of multiple independent tasks and retrieving the results via callbacks or waiting until everything is done.

Also known as


iluwatarAbout 3 minConcurrencyAsynchronousReactiveScalability
Callback

Intent

Callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time.

Also known as

  • Event-Subscription
  • Listener

Explanation

Real world example


iluwatarAbout 2 minFunctionalAsynchronousDecouplingIdiomReactive
Event-Based Asynchronous

Also known as

  • Asynchronous Event Handling

Intent

The Event-Based Asynchronous pattern allows a system to handle tasks that might take some time to complete without blocking the execution of the program. It enables better resource utilization by freeing up a thread that would otherwise be blocked waiting for the task to complete.


iluwatarAbout 3 minConcurrencyAsynchronousDecouplingEvent-drivenFault toleranceMessagingReactiveScalability
Event-Driven Architecture

Also known as

  • Event-Driven System
  • Event-Based Architecture

Intent

Event-Driven Architecture (EDA) is designed to orchestrate behavior around the production, detection, consumption of, and reaction to events. This architecture enables highly decoupled, scalable, and dynamic interconnections between event producers and consumers.


iluwatarAbout 3 minArchitecturalAsynchronousDecouplingEnterprise patternsEvent-drivenMessagingPublish/subscribeReactiveScalability
Event Queue

Also known as

  • Event Stream
  • Message Queue

Intent

The Event Queue pattern is designed to manage tasks in an asynchronous manner, allowing applications to handle operations without blocking user interactions or other processes.

Event Queue Visualised

iluwatarAbout 3 minConcurrencyAsynchronousDecouplingMessagingEvent-drivenScalability
Fan-Out/Fan-In

Also known as

  • Scatter-Gather

Intent

The Fan-Out/Fan-In pattern aims to improve concurrency and optimize processing time by dividing a task into multiple sub-tasks that can be processed in parallel (fan-out) and then combining the results of these sub-tasks into a single outcome (fan-in).


iluwatarAbout 3 minConcurrencyAsynchronousData processingDecouplingScalability
Guarded Suspension

Also known as

  • Conditional Block
  • Suspended Execution

Intent

The Guarded Suspension pattern manages operations that require both a lock and a condition to proceed, allowing a thread to wait for an appropriate condition while being efficient with resource use.


iluwatarAbout 2 minConcurrencyAsynchronousDecouplingResource managementSynchronizationThread management
Half-Sync/Half-Async

Also known as

  • Async-Sync Bridge
  • Half-Synchronous/Half-Asynchronous

Intent

The Half-Sync/Half-Async pattern aims to decouple asynchronous and synchronous processing in concurrent systems, allowing efficient interaction and data exchange between asynchronous and synchronous components.


iluwatarAbout 3 minConcurrencyAsynchronousDecouplingSynchronizationThread management