g*****g 发帖数: 34805 | 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. |
g*****g 发帖数: 34805 | 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.
|
t*******e 发帖数: 684 | 3 同一个JVM的话,local method call就可以了,不同JVM的话,各种protocol都可以用
,类似RMI/JRMP,SOAP/HTTP,XML-RPC,还有Spring带的两个Hessian, Burlap等等。 |
g*****g 发帖数: 34805 | 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等等。
|
A**o 发帖数: 1550 | 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.
|
t*******e 发帖数: 684 | 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. |
g*****g 发帖数: 34805 | 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?
|
A**o 发帖数: 1550 | 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.
|
t*******e 发帖数: 684 | 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.
|
g*****g 发帖数: 34805 | 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.
|
|
|
t*******e 发帖数: 684 | 11 RMI is a very decent solution, unless the communication goes through a
firewall. |
g*****g 发帖数: 34805 | 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.
|
m******t 发帖数: 2416 | 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);
|
A**o 发帖数: 1550 | 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
|
g*****g 发帖数: 34805 | 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
|
k***r 发帖数: 4260 | 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 |