You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Peter Romianowski <an...@gmx.de> on 2001/08/06 16:49:59 UTC

Dynamic Configuration (at run time)

Hi there,

for the application I write I need to construct a lot of mail aliases
(forwards) at runtime. I already set up aliases using the <mailet
match="RecipientIs=xyz@abc.com" class="Forward"> - thing. Works great. But
with this solution I hava to restart James in order to read the
configuration again.
Is there any way to add mailet-configuration at runtime?

thanks,
pero


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Dynamic Configuration (at run time)

Posted by Oki DZ <ok...@pindad.com>.
On Wed, 8 Aug 2001, Serge Knystautas wrote:

> Right now there's now way to do this at runtime.  We are partially hoping
> that Avalon will support reloading of the server app, but I was thinking we

I think you don't have to wait the feature to be supported by Avalon. 
Currently, James (James.class) request the services provided by Avalon in
its initialize() method; eg: the request for MailStore and UsersStore. 
After the object references gotten from the service blocks, _then_ they
are configured. So I think configuring the servicing blocks when James is
already running is possible. What you need to have is a method in
James.class that does the reconfiguration. There must be some ways to
shutdown the reconfigured services, though. For spool repositories, I
don't think there would be much problem; you can just request a new 
(to be reconfigured) one from Avalon. 

Problems may arise on the threads that are dependent on the repositories; 
such as the spool manager. It's a thread, and has several other depending
threads (eg: RemoteDelivery mailet) which are always busy running. There
must be ways to properly stop those threads, and the sequence of which
threads should be stopped first. But since threads are interruptible, I
think all you need to do is to have a proper way to do the cleanup in the
InterruptedException try-block (eg: returning the db connection to the
pool). 

> may go ahead and add this for just the mailets, since really we don't want
> the entire application to restart, just the mailet processing configuration.
> We'd have to take a custom class loader so we could reload these easily, and

Some tweaking in James.class would do the trick, I guess.

> maybe at some point even support automatic compilation for changed classes,
> and other things that web application servers do.

Yes, just like Tomcat does.

Oki






---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


AW: Dynamic Configuration (at run time)

Posted by Peter Romianowski <an...@gmx.de>.
Hi there,

thanks for the ideas. For my purpose the best choice would be writing a
matcher based on a database.
Here's a suggestion for other dynamic configuration:
For the applications which require dynamic configuration, I wrote some kind
of "configuration-framework".
This lets you use different configuration sources (properties-file,
database, xml or what ever) and has a built-in
reload-mechanism on specified events. For XML-configuration this event is
the file-modification. If such an event is fired all objects using the
configuration are notified (if they choose to listen for that event) and can
aply the new properties.
I am aware that there are situations where properties cannot be dynamic, but
mailetconfiguration should be no problem.
I think that at least dynamic mailet-configuration would boost the usability
and maintainability (is there such word? I'm just a german lamer... :-) of
JAMES, so I would like to see such things.
I don't know the general "masterplan" for the near future of JAMES, but if
others think that this feature may be useful and important I would discuss a
bit more about that. And of course I would help coding this feature...

greetz
Peter Romianowski

> -----Ursprüngliche Nachricht-----
> Von: Serge Knystautas [mailto:sergek@lokitech.com]
> Gesendet: Mittwoch, 8. August 2001 21:01
> An: james-user@jakarta.apache.org; antarapero@gmx.de
> Betreff: Re: Dynamic Configuration (at run time)
>
>
> Right now there's now way to do this at runtime.  We are partially hoping
> that Avalon will support reloading of the server app, but I was
> thinking we
> may go ahead and add this for just the mailets, since really we don't want
> the entire application to restart, just the mailet processing
> configuration.
> We'd have to take a custom class loader so we could reload these
> easily, and
> maybe at some point even support automatic compilation for
> changed classes,
> and other things that web application servers do.
>
> But like someone said, for forwarding you may just want to do it
> based on a
> database table (or file).
>
> Serge Knystautas
> Loki Technologies
> http://www.lokitech.com/
> ----- Original Message -----
> From: "Peter Romianowski" <an...@gmx.de>
> To: <ja...@jakarta.apache.org>
> Sent: Monday, August 06, 2001 10:49 AM
> Subject: Dynamic Configuration (at run time)
>
>
> > Hi there,
> >
> > for the application I write I need to construct a lot of mail aliases
> > (forwards) at runtime. I already set up aliases using the <mailet
> > match="RecipientIs=xyz@abc.com" class="Forward"> - thing. Works
> great. But
> > with this solution I hava to restart James in order to read the
> > configuration again.
> > Is there any way to add mailet-configuration at runtime?
> >
> > thanks,
> > pero
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: james-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Dynamic Configuration (at run time)

Posted by Serge Knystautas <se...@lokitech.com>.
Right now there's now way to do this at runtime.  We are partially hoping
that Avalon will support reloading of the server app, but I was thinking we
may go ahead and add this for just the mailets, since really we don't want
the entire application to restart, just the mailet processing configuration.
We'd have to take a custom class loader so we could reload these easily, and
maybe at some point even support automatic compilation for changed classes,
and other things that web application servers do.

But like someone said, for forwarding you may just want to do it based on a
database table (or file).

Serge Knystautas
Loki Technologies
http://www.lokitech.com/
----- Original Message -----
From: "Peter Romianowski" <an...@gmx.de>
To: <ja...@jakarta.apache.org>
Sent: Monday, August 06, 2001 10:49 AM
Subject: Dynamic Configuration (at run time)


> Hi there,
>
> for the application I write I need to construct a lot of mail aliases
> (forwards) at runtime. I already set up aliases using the <mailet
> match="RecipientIs=xyz@abc.com" class="Forward"> - thing. Works great. But
> with this solution I hava to restart James in order to read the
> configuration again.
> Is there any way to add mailet-configuration at runtime?
>
> thanks,
> pero
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: james-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org


Re: Dynamic Configuration (at run time)

Posted by Oki DZ <ok...@pindad.com>.
On Mon, 6 Aug 2001, Peter Romianowski wrote:
> for the application I write I need to construct a lot of mail aliases
> (forwards) at runtime. I already set up aliases using the <mailet
> match="RecipientIs=xyz@abc.com" class="Forward"> - thing. Works great. But
> with this solution I hava to restart James in order to read the
> configuration again.
> Is there any way to add mailet-configuration at runtime?

There is, if you have the will...

Anyway, the easiest way would be to write a matcher that reads the values
from a table in a database. 

Oki




---------------------------------------------------------------------
To unsubscribe, e-mail: james-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-user-help@jakarta.apache.org