質問

I have a task of reading emails from Lotus Dominos mailbox. To perform the same I am have following two options (there might be other options as well):

  1. Create a Java Agent within the mailbox and schedule it. It will process the mails and take actions.\
  2. Write separate Java code with used Notes API and call dominos server to fetch mails and process them.

What is difference in both? Capabilities or something else?

役に立ちましたか?

解決

Write a Java Agent to run inside the email server

Pros

  1. Lets you leverage all of the resiliency of the email server itself
  2. Can be reasonably guaranteed to start and stop with the email server
  3. Less code to manage
  4. Easier to keep error logging with email server

Cons

  1. Vendor specific so it will be less portable

Reason for personal opinion

I wrote a client that used IMAP to read emails inside an inbox periodically and I set up a James Mail Server with something like the agent you are talking about to programmatically respond to emails that were received by an email address. I tend to like your option 1 (a Java agent running inside the email server) because it lets you leverage all of the resiliency of the email server itself. The code can be reasonably guaranteed to start and stop with the email server and it's logging is connected to the logging of the server. Making a stand alone agent has the benefit of working with servers other than your initial configuration (especially if you leverage standard protocols). But you have to do more to make sure it is operational and you have to work harder to debug (in my own experience). Also, the Java Agent approach tends to be smaller so there is less code to manage.

他のヒント

If you are monitoring just one mailbox, then a Java agent has an obvious advantage because it does not need any configuration data. You just put the agent in the actual mailbox database and it calls AgentContext.getCurrentDatabase when it runs. If you are monitoring just a few maiboxes, you can just duplicate the agent, and again each instance just reads AgentContext.getCurrentDatabase. But if you have many mailboxes, then you probably don't want to duplicate it all over the place. You probably want just a single agent, or a stand-alone program -- and in both cases you will need some configuration data to control it. This is the case where I might consider running it stand-alone instead of as an agent.

But that would raise the question: How do you want to manage the configuration data? And another question comes from that: Who will manage the configuration data? If the answer is that the administrator of the Domino server will also manage the configuration of the process that is reading the mailbox data, then I would suggest that you should use a configuration tool that you know is familiar to all Domino administrators. That might be a group in the Domino Directory listing the names of the mailboxes, or it might be a Notes database containing a configuration document for each mailbox you are monitoring. And if you decide to go this way, then my preference would still be to use a Domino agent that reads the configuration information on the Domino server and reads the data from the configured mailboxes. But here the advantage isn't as strong. You could configure it in Domino but still run standalone. The stand-alone code would just need to be configured so that it knows where to look for its configuration data and that could just be a command line, like 'java myprog dominoServerName configDatabaseName'.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top