As I told, our MailRepositories and SpoolRepositories (both file and
jdbc specializations) needs Locking their own way. The locking provided
by the filesystem or by sql server will not work.
Basically James "accept" a message from the spool (read it, and LOCK it
in the application), then it process it (the message is still in the
original table) and when the processing is finisced it deletes the
message or at least UNLOCK it.
In the mean time others threads of the same application will ignore that
message because of the LOCK we have in memory. If the threads have no
access to the locks table then the same message could be processed by 2
james at the same time: both will process it, one of them will delete it
and the other will throw an error when it will try to delete it and it
is already been deleted. But in the end the message will be processed TWICE.
Maybe we should add this to the FAQs: but you should take care that when
an application does not specifically document that it support clustering
this way, most time it won't work.
Workarounds?
1) distributed locking (see james-ha on sourceforge as an example,
because it is outdated).
2) use of SMTP primary/secondary MX servers, without shared tables
between the servers.
3) use at least separate SpoolRepositories and share only
MailRepositories (I'm not sure but this should work), then you write a
script to move mails from one spool to the other when one of the servers
goes down.
Stefano
sunsetartproducts ha scritto:
I use this set-up for the whitelist and spam analysis with 2 instances of
James 2.3.0 on different servers sharing a MySql database on a third server.
One machine is the fallover machine the other the primary mail server. I
have not tried using the database to hold the mails, just the whitelist and
spam database. But at least in theory Mysql would allow access by two
different instances, as the file locking in MySQL is at the database level.
When I am using it in this way, I can add or remove data from the database
from either mail server, MySQL just waits to finish the first process before
committing to the next. (not much of a wait as the processes take only a
millisecond or less.) Of course the servers are only 10 feet apart and have
only one hop on a switch to navigate.
If you are using a file system repository for the mails data instead of a
SQL Server database, then you would run into the problem of file locking if
the two servers were trying to access the same files on the hard drive at
the same time.
John G. Norman-2 wrote:
Stephano,
THANKS.
John
On 3/8/07, Stefano Bagnara <[EMAIL PROTECTED]> wrote:
You can't use the same db table for 2 different repositories instances
because the locking is at an application level. You would need to
rewrite a distributed locking support (someone did something about this
in past: see james-ha project on sourceforge).
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]