43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
# Provider 使用 JSON POST;供应商重试由独立 Fetch 策略控制。
|
||
version: 1
|
||
security: {requireProtectionOnPublicListen: true}
|
||
gateway: {enabled: true, listen: '127.0.0.1:8080', auth: {mode: none}}
|
||
routing:
|
||
- name: gateway
|
||
enabled: true
|
||
purpose: gateway
|
||
match: {hostRegex: '.*'}
|
||
upstreams: [provider-a]
|
||
strategy: {type: leastConnections}
|
||
onUnavailable: {action: reject}
|
||
upstreams:
|
||
provider-a:
|
||
enabled: true
|
||
exposure: [gateway]
|
||
provider: {billingMode: fetch, protocols: [http]}
|
||
api:
|
||
url: https://provider-a.example/v1/orders
|
||
method: POST
|
||
auth: {type: apiKey, location: header, name: X-Provider-Key, value: "${PROVIDER_API_KEY}"}
|
||
headers: {Content-Type: application/json}
|
||
body:
|
||
type: json
|
||
value: {count: '100', protocol: http}
|
||
template: '{{.}}'
|
||
proxyAuth: {type: response}
|
||
pool: {maxSize: 1000}
|
||
capacity: {maxConcurrencyPerProxy: 10}
|
||
refill: {reconcileInterval: 1s, minimumAvailableSlots: 25, targetAvailableSlots: 50}
|
||
lifecycle: {ttl: 3m, allocationSafetyMargin: 20s}
|
||
fetch:
|
||
estimatedIPsPerCall: 10
|
||
requestInterval: 2s
|
||
timeout: 5s
|
||
maxAttempts: 3
|
||
maxInFlight: 1
|
||
maxTotal: 100000
|
||
maxResponseBytes: 1048576
|
||
templateTimeout: 100ms
|
||
retry: {initial: 1s, max: 30s, jitter: 20}
|
||
check: {interval: 30s, jitter: 20, maxInFlight: 100, timeout: 2s, maxAttempts: 2, maxConsecutiveFailures: 3}
|