Redian新闻
>
Jetty embeded server communication question?
avatar
Jetty embeded server communication question?# Java - 爪哇娇娃
g*g
1
I have a program which is an email server, we want to embed a web console
and do configuration on the fly.
I can use an embeded jetty as web server. Now between email server and web
console, how can I do communication?
For example, I finish configuration in web console, new configuration data
available in database, how do I inform the the email server to pick up the
configuration?
MBean? Appreicate it if someone can tell me how to communite with
an embeded jetty.
avatar
g*g
2
I am leaning towards RMI now, is there any better way?

【在 g*****g 的大作中提到】
: I have a program which is an email server, we want to embed a web console
: and do configuration on the fly.
: I can use an embeded jetty as web server. Now between email server and web
: console, how can I do communication?
: For example, I finish configuration in web console, new configuration data
: available in database, how do I inform the the email server to pick up the
: configuration?
: MBean? Appreicate it if someone can tell me how to communite with
: an embeded jetty.

avatar
t*e
3
同一个JVM的话,local method call就可以了,不同JVM的话,各种protocol都可以用
,类似RMI/JRMP,SOAP/HTTP,XML-RPC,还有Spring带的两个Hessian, Burlap等等。
avatar
g*g
4
我的问题是web server要作为client call background process,这个process是
一个email server,而不是反过来,这样基于web的各种协议都不行吧。
我能想到的只有RMI和JMX
如果基于jetty的话可以只用一个jvm,但是我不知道怎么local function call,
也许调用jetty的时候可以放一个参数进去?
好像是可以
Server jettyServer = new Server(jettyConfig);
jettyServer.setAttribute("hello", helloBean);

【在 t*******e 的大作中提到】
: 同一个JVM的话,local method call就可以了,不同JVM的话,各种protocol都可以用
: ,类似RMI/JRMP,SOAP/HTTP,XML-RPC,还有Spring带的两个Hessian, Burlap等等。

avatar
A*o
5
how operateable is this email server?
anything exposed to public or you have full control of new api?

【在 g*****g 的大作中提到】
: I have a program which is an email server, we want to embed a web console
: and do configuration on the fly.
: I can use an embeded jetty as web server. Now between email server and web
: console, how can I do communication?
: For example, I finish configuration in web console, new configuration data
: available in database, how do I inform the the email server to pick up the
: configuration?
: MBean? Appreicate it if someone can tell me how to communite with
: an embeded jetty.

avatar
t*e
6
It depends on your SMTP server, whether it exposes an interface and keeps
listening for changing configuration requests. If not, I don't think there
is anyway to update its configurations on the fly.
avatar
g*g
7
It's based on apache james and I do have most of the controls
I need. e.g. I can expose a configuration bean, the problem is
how to invoke it. I am seeking a same JVM solution, but I am
not familiar with jetty, I don't know how to make a bean
available for web app running in jetty container.

【在 A**o 的大作中提到】
: how operateable is this email server?
: anything exposed to public or you have full control of new api?

avatar
A*o
8
if you are in a hurry, just have the email server
scan for config update every minute.
then, you have test other solutions maybe mbeans.

【在 g*****g 的大作中提到】
: I have a program which is an email server, we want to embed a web console
: and do configuration on the fly.
: I can use an embeded jetty as web server. Now between email server and web
: console, how can I do communication?
: For example, I finish configuration in web console, new configuration data
: available in database, how do I inform the the email server to pick up the
: configuration?
: MBean? Appreicate it if someone can tell me how to communite with
: an embeded jetty.

avatar
t*e
9

This is a good solution.
It doesn't seem possible to start jetty and james through a single JVM.

【在 A**o 的大作中提到】
: if you are in a hurry, just have the email server
: scan for config update every minute.
: then, you have test other solutions maybe mbeans.

avatar
g*g
10
People are impatient, 1 minute is too long, they probably want
to see effect immediately in a demo. One the other hand,
scanning too often will degrade performance. I think I'll stick
to RMI solution, it's not very difficult.

【在 A**o 的大作中提到】
: if you are in a hurry, just have the email server
: scan for config update every minute.
: then, you have test other solutions maybe mbeans.

avatar
t*e
11
RMI is a very decent solution, unless the communication goes through a
firewall.
avatar
g*g
12
No, I think normally they sit on the same box. There's no need
to separate an email server from its webconsole.

【在 t*******e 的大作中提到】
: RMI is a very decent solution, unless the communication goes through a
: firewall.

avatar
m*t
13

I thought the whole point of you _embedding_ jetty
was to have it running in the same jvm as the email server.
So looks to me like you just need to wrap the email server
config api in mbeans, and deploy them into jetty, which just
needs to host a jmx console.
Another idea that might sound crazy but I think actually
would work is sending the config changes to the email
server in, well, emails. The sender can just digitally
sign the email for authentication. The email can further
have a special

【在 g*****g 的大作中提到】
: 我的问题是web server要作为client call background process,这个process是
: 一个email server,而不是反过来,这样基于web的各种协议都不行吧。
: 我能想到的只有RMI和JMX
: 如果基于jetty的话可以只用一个jvm,但是我不知道怎么local function call,
: 也许调用jetty的时候可以放一个参数进去?
: 好像是可以
: Server jettyServer = new Server(jettyConfig);
: jettyServer.setAttribute("hello", helloBean);

avatar
A*o
14
that's something new. cool.

【在 m******t 的大作中提到】
:
: I thought the whole point of you _embedding_ jetty
: was to have it running in the same jvm as the email server.
: So looks to me like you just need to wrap the email server
: config api in mbeans, and deploy them into jetty, which just
: needs to host a jmx console.
: Another idea that might sound crazy but I think actually
: would work is sending the config changes to the email
: server in, well, emails. The sender can just digitally
: sign the email for authentication. The email can further

avatar
g*g
15
Thanks, that's some nice ideas.

【在 m******t 的大作中提到】
:
: I thought the whole point of you _embedding_ jetty
: was to have it running in the same jvm as the email server.
: So looks to me like you just need to wrap the email server
: config api in mbeans, and deploy them into jetty, which just
: needs to host a jmx console.
: Another idea that might sound crazy but I think actually
: would work is sending the config changes to the email
: server in, well, emails. The sender can just digitally
: sign the email for authentication. The email can further

avatar
k*r
16
If you have control over how the smtp server is started, then you can write
your own code to start it (in a separate thread), and also write your own
code to start the embedded web server.
If the smtp server is configurable, it must have some API exposed. Call them
from your web server URL handlers.
For the web server, check out winstone. It's the smallest applet container
in the world and probably also the easiest to use for embedded usage. Just
include the jar in the classpath and call it from
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。