WebhookNotifier
class WebhookNotifier(uri: URI, format: WebhookNotifier.Format = Format.GENERIC, kinds: Set<ParkedNotice.Kind> = ParkedNotice.Kind.entries.toSet(), service: String? = null, headers: Map<String, String> = emptyMap(), timeout: Duration = DEFAULT_TIMEOUT, client: HttpClient = HttpClient.newBuilder().connectTimeout(timeout.toJavaDuration()).build()) : ParkedNotifier
Posts each ParkedNotice of kinds to the webhook at uri, as JSON, through the JDK's HTTP client within timeout: a response other than 2xx fails the notification, which the runtime logs.
Format.GENERIC:
{"event", "service", "group", "at", "entry", "text"},entryas the operator's routes write it (parkedRoutes) andtexta Markdown summary.Format.WECOM: a WeCom (企业微信) group robot's Markdown message,
{"msgtype": "markdown", "markdown": {"content"}}, as 9.x's compensation webhook sent it; a robot that answers anerrcodeother than 0 fails the notification.
service names the service in the message; headers are added to each request (a token, say).
Constructors
Link copied to clipboard
constructor(uri: URI, format: WebhookNotifier.Format = Format.GENERIC, kinds: Set<ParkedNotice.Kind> = ParkedNotice.Kind.entries.toSet(), service: String? = null, headers: Map<String, String> = emptyMap(), timeout: Duration = DEFAULT_TIMEOUT, client: HttpClient = HttpClient.newBuilder().connectTimeout(timeout.toJavaDuration()).build())