StaticRoutingStrategy
Overview
The StaticRoutingStrategy
is the simplest routing strategy that always returns a single, pre-configured gateway URL. This strategy ignores any gateways provided by the GatewaysProvider
and is useful for scenarios where you want to force all requests to use a specific gateway.
How It Works
The strategy always returns the configured gateway, ignoring any provided gateway lists:
- Configure Gateway: Set a single gateway URL during initialization
- Ignore Provided Gateways: Any gateways from providers are ignored
- Return Static Gateway: Always return the same configured gateway
- Log Warnings: Warn when provided gateways are ignored
Configuration
Basic Usage
With Custom Gateway
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
gateway | string | required | The gateway URL to always use |
logger | Logger | defaultLogger | Optional logger instance |
Related
- FastestPingRoutingStrategy: Network-based gateway discovery
- PreferredWithFallbackRoutingStrategy: Static gateway configuration
- RandomRoutingStrategy: Randomized gateway selection