Browse Java Design Patterns & Enterprise Application Architecture

Invoker, Command, and Receiver Roles

Distinguish the Command roles in Java so request creation, request invocation, and actual work execution stay properly separated.

On this page

The Command pattern is easiest to reason about when its three roles stay distinct.

    flowchart LR
	    A["Client"] --> B["Creates command"]
	    B --> C["Invoker"]
	    C --> D["Calls execute()"]
	    D --> E["Command"]
	    E --> F["Receiver performs real work"]

Invoker

The invoker decides when to run the command. It should not need receiver-specific details.

Command

The command packages the request, binding any required inputs and receiver reference.

Receiver

The receiver owns the real business action.

Review Rule

If the invoker still knows receiver details or if the command does the entire business workflow itself, the role separation is collapsing.

Revised on Thursday, April 23, 2026