有没有办法让 C# 使用 MBean 通过 JMX 与 Java 服务器进行通信?
我有一个用 Java 编写的服务器,用于为各种客户端的 HTTP 请求提供服务。我还在该服务器上通过 JMX 公开了一些 MBean,监视工具可以从中监视某些服务器资源并协助维护。
系统/集成测试 HTTP 端点的所有代码都是 C# 完成的。因此,我希望尝试使用 C# 通过 JMX 测试我的 MBean。是否已经存在执行此类操作的库,或者我必须自己去实现该协议?我还有哪些其他选择(使用 C#)?
I have a server written to Java to service HTTP requests for various clients. I also have some MBeans on this server exposed over JMX from which a monitoring tool can keep an eye on some the servers resources and assist in maintenance.
All code that system/integration tests HTTP endpoints is done is C#. Because of this, I was hoping to try to use C# to also test my MBeans over JMX. Does a library to do such a thing already exist, or would I have to go about implementing the protocol myself? What other options (with C#) might I have?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用像 Jolokia 这样的 JMX 桥,它通过 HTTP 和 JSON 向外界公开 MBean。有几个可用的客户端库(Java、Perl、Javascript),遗憾的是还不适用于 C#。然而,由于该协议有很好的记录,因此访问起来应该不难C# 的 Jolokia 代理也是如此。该协议支持 GET 请求,因此使用它主要意味着创建正确的 HTTP Url、发送 HTTP 请求并将 HTTP 响应解析为 JSON。还有一个如何在 bash 脚本中执行此操作的示例。
You could use a JMX Bridge like Jolokia which exposes MBeans via HTTP and JSON to the outside world. Several client libraries are available (Java, Perl, Javascript), unfortunately not for C# yet. However, since the protocol is well documented, it should not be that hard to access the Jolokia agents from C# as well. The protocol supports GET requests, so using it mostly only implies to create a proper HTTP Url, send the HTTP request and parse the HTTP-Response as JSON. There is also a sample how to do this in a bash script.
我可以证明 Jolokia 的可用性。优秀的产品。
两个附加选项:
I can attest to the usability of Jolokia. Excellent product.
Two additional options: