简体   繁体   English

Ratpack 中的 /buildinfo 和 /health API 请求

[英]/buildinfo and /health API requests in Ratpack

I am building a micro-service using Ratpack.我正在使用 Ratpack 构建一个微服务。 I have a basic understanding of how requests are routed using chaining in ratpack.我对如何使用 ratpack 中的链接来路由请求有一个基本的了解。 But what I can't understand is how my server responds to the "/buildinfo" and "/health" requests when I haven't defined any handler for these.但我无法理解的是,当我没有为这些请求定义任何处理程序时,我的服务器如何响应“/buildinfo”和“/health”请求。

I want to know how I can modify and send some data which I want to as a response to these requests.我想知道如何修改和发送一些我想作为对这些请求的响应的数据。

It's an inbuilt feature.这是一个内置功能。

Ratpack does provide the HealthCheck interface which you can implement and write your own handler and override the check method to return your desired response when you call /health. Ratpack 确实提供了 HealthCheck 接口,您可以实现和编写自己的处理程序并覆盖检查方法以在您调用 /health 时返回所需的响应。 You will need to add your new handler to your registry.您需要将新的处理程序添加到您的注册表中。

This article provides a good explanation and example https://blog.mrhaki.com/2015/11/ratpacked-add-health-checks.html本文提供了很好的解释和示例https://blog.mrhaki.com/2015/11/ratpacked-add-health-checks.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM