[英]Is there a way for C# to communicate with a Java server via JMX using MBeans?
I have a server written to Java to service HTTP requests for various clients.我有一个写入 Java 的服务器来为各种客户端的 HTTP 请求提供服务。 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.
我还在这台服务器上通过 JMX 公开了一些 MBean,监视工具可以从中监视一些服务器资源并协助维护。
All code that system/integration tests HTTP endpoints is done is C#.系统/集成测试 HTTP 端点的所有代码都是 C#。 Because of this, I was hoping to try to use C# to also test my MBeans over JMX.
因此,我希望尝试使用 C# 来通过 JMX 测试我的 MBean。 Does a library to do such a thing already exist, or would I have to go about implementing the protocol myself?
是否已经存在执行此类操作的库,还是我必须 go 自己实现协议? What other options (with C#) might I have?
我还有哪些其他选项(使用 C#)?
You could use a JMX Bridge like Jolokia which exposes MBeans via HTTP and JSON to the outside world.您可以使用像Jolokia这样的 JMX 桥,它通过 HTTP 和 JSON 向外界公开 MBean。 Several client libraries are available (Java, Perl, Javascript), unfortunately not for C# yet.
有几个客户端库可用(Java、Perl、Javascript),遗憾的是 C# 还没有。 However, since the protocol is well documented , it should not be that hard to access the Jolokia agents from C# as well.
但是,由于该协议有据可查,因此从 C# 访问 Jolokia 代理也不难。 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.
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.
在 bash 脚本中还有一个示例如何执行此操作。
I can attest to the usability of Jolokia.我可以证明 Jolokia 的可用性。 Excellent product.
优秀的产品。 Two additional options:
两个附加选项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.