Upstream Modes v3.9.0
Upstream modes define how GripMock handles requests when reflection sources are used.
⚠️ EXPERIMENTAL FEATURE: Upstream modes (proxy, replay, capture) are experimental and may change without notice.
Modes at a glance
proxy: pure reverse proxy through GripMock.replay: local stubs first, upstream fallback on real matcher miss.capture: replay behavior plus automatic recording of upstream misses.
Why this matters
For a typical Order Service rollout, modes let you move in predictable stages:
- Start with
proxyto route all traffic through GripMock and inspect real calls. - Move to
replaywhen you have initial stubs and still need upstream fallback. - Use
captureto accelerate coverage and transition away from live dependency.
Reflection vs mode
- Reflection source (
grpc://,grpcs://) => how descriptors are loaded. - Upstream mode (
+proxy,+replay,+capture) => how runtime requests are resolved.
URL schemes
grpc+proxy://host:portgrpc+replay://host:portgrpc+capture://host:portgrpcs+proxy://host:portgrpcs+replay://host:portgrpcs+capture://host:port
Multi-source mode binding
When multiple sources are provided:
- the mode applies only to services registered from that source;
- if a service exists in multiple sources, first source wins for that service;
- later sources do not override already-bound services.
Example:
bash
gripmock \
grpc+proxy://proxy:123 \
grpc+replay://proxy1:321 \
grpc+capture://proxy2:444If services overlap like (greeter greeter1) (greeter1 greeter2) (greeter2 greeter3), final binding is:
greeter,greeter1->proxygreeter2->replaygreeter3->capture