如何在请求中识别EJB的客户端或调用者? [英] How can I identify the client or caller of an EJB within the request?

查看:90
本文介绍了如何在请求中识别EJB的客户端或调用者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个系统,其中几个(约20个)Web应用程序服务器(托管一个网站)(通过VIP)与相同的2-4个EJB服务器通信。我想知道是否可以确定其中哪一个应用服务器生成了特定请求。

I have a system where several (20 or so) web app servers (hosting a website) talk to the same 2 - 4 EJB servers (through a VIP). I'd like to know if it is possible to identify which one of those app servers generated a specific request.

例如:Website example.com通过发送HTTP请求来工作到20个应用服务器中的任何一个以处理请求。这些服务器的名称(内部)为 app01 app20 。确保将具有相同会话ID的所有请求都路由到同一应用服务器,从而使我们能够从逻辑上跟踪来自单个用户的所有请求。某些请求将需要一些无法直接获得的额外数据,为此,在另一个由3个服务器组成的集群中,有一个EJB(2.1)应用程序,名为 ejb01 ejb03 。通过VIP( ejb00 )建立到EJB服务器的连接,该路由将请求循环方式路由到三个EJB服务。

For example: Website example.com works by sending HTTP requests to any of 20 app servers to handle the request. These servers are named (internally) app01 through app20. It is ensured that all requests with the same session ID will be routed to the same app server, thus enabling us to logically track all requests from a single user. Some requests will need some extra data not available directly, for which there is an EJB (2.1) application on another cluster of 3 servers, named ejb01 to ejb03. Connections to the EJB servers are made through a VIP (ejb00), which routes the requests round-robin style to the three EJB serves.

在EJB服务器的日志记录(我们使用Apache Log4J)中,如果我能确定请求来自20个应用程序服务器中的哪个服务器,那将是非常不错的。另一种方法是分别检查每台服务器上的日志-但是我没有一个好的方法来通过20个不同框中的日志来 grep

Within the logging (we use Apache Log4J) of the EJB servers, it would be really nice if I could identify which of the 20 app servers a request originated from. The alternative is checking the logs on each server separately - but I don't have a good way to grep through the logs on 20 different boxes.

我的问题是:在标准EJB中可能吗?如果没有其他事情,我愿意做一些非标准的事情,但这必须可靠并且可以在我的系统上工作。我们在Web应用程序和EJB服务器上都使用了Weblogic 11g。

My question is: is this possible within Standard EJB? I'd be willing to do something non-standard, if there was nothing else, but it's gotta be reliable and work on my system. We use Weblogic 11g, both for the web-app and the EJB servers.

我已经看到一些建议,将调用者的身份作为参数传递,但这会

I've seen suggestions to pass the identity of the caller as a parameter, but that would mean an extra parameter for each of 20+ EJB methods, and that's rather unwieldy.

任何解决方案,有人吗?

Any solutions, anyone?

推荐答案

没有标准解决方案。 JSR 149 中有一个提案,但已被撤消。向远程方法添加额外的参数可能是您的最佳选择。如果使用RMI远程,则可以编写ORB拦截器以在客户端添加自定义上下文,在服务器端接收它,并在服务器上的方法调用周围设置本地线程。

There is no standard solution. There was a proposal in JSR 149, but it was withdrawn. Adding an extra parameter to the remote methods is probably your best option. If you're using RMI remote, you might be able to write an ORB interceptor to add a custom context on the client side, receive it on the server side, and set a thread local around the method invocation on the server.

WebSphere Application Server具有称为工作区,它确实适用于远程EJB。

WebSphere Application Server has a non-standard solution called work areas, which does work for remote EJB.

我是对WebLogic不熟悉,所以我不知道他们是否有类似的解决方案。搜索相似的术语会发现一个 WorkContextMap ,但我不知道它是否适用于远程EJB,因为我能找到的所有示例都是针对Web服务的。

I am not familiar with WebLogic, so I don't know if they have a similar solution. Searching for similar terms finds a WorkContextMap that looks similar, but I don't know if it works for remote EJB since all the examples I can find are for webservices.

这篇关于如何在请求中识别EJB的客户端或调用者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆