(see inline)
On 24/10/2012 09:12, Marco Zapletal wrote:
Hi folks,
in our environment, we need to synchronize the state of messages within
James (using JPA mailbox) with an external system. This means that (i)
when messages get fetched/deleted using IMAP, I want to call some Java
code that updates an external database and (ii) when changes to the
external database are made, the corresponding message flags should be
set in the James database.
In order to achieve that, I thought about the following approaches:
Regarding (i) the MessageListener may be of help, since it allows to
provide hooks for flags such as SEEN and DELETED. In this respect, my
question would be how to register my own MessageListener implementation?
Look at the imap processor implementations. That's where the listeners
are registered. Search for addListener in
https://svn.apache.org/repos/asf/james/protocols/trunk/imap/src/main/java/org/apache/james/imap/processor/base/SelectedMailboxImpl.java
https://svn.apache.org/repos/asf/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
...
In terms of (ii), the cleanest approach would be store the messageId of
the external system within a custom JPA entity inheriting from
JPAMessage. The corresponding messageId would be transferred as a header
of the MimeMessage to store. This means, I would require to add some
custom code, when the JPAMessage is created based on the MimeMessage. Is
this possible in James, and if so, could someone provide me with a hint
how to do this?
Not sure to understand what you want. In your introduction, you say that
you want to update james based on a change in an external database. Can
you confirm?
Thanks and best regards,
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]