Jerry M ha scritto: > I understand all of the configuration stuff in assembly and config. But > I'm confused on your statement about how to get messages into the > alternate spool. It appears from what you are saying that the message > goes onto the original spool, and when it's processed I need to have a > matcher/mailet that recognizes a characteristic of the email and then > moves it to the other spool. If that's the case, it won't really solve > my problem. I need to totally bypass the original spool. If the > original spool is getting clogged up, then my notification message will > be stuck in the traffic and won't get moved to the 2nd spool until it > works its way up in the original queue which defeats the original intent. > > I was figuring I could put in a 2nd smtp processor on a different port > and have it drop messages directly into the 2nd spool completely > bypassing the original spool. But I can't find any configuration that > tells the smtp server which spool to drop messages on. Is there a way > to configure this? Or am I completely misunderstanding your solution, > and it does indeed bypass the original spool completely?
If you want completely separated input chains then you probably have to duplicate much more than the smtpserver and the spoolrepository. I should try duplicating much more components: the "James" block provides the services used by the smtpserver to inject new mails. So you will need a "James2" block (that will be used by your smtpserver2 block). The James2 will have the same dependencies of James but spoolrepository that will be replaced by spoolrepository2. Then you will need a spoolmanager2 to operate on this spoolrepository. Unfortunately if you want to keep really separated process you will have also to duplicate matcherpackages and mailetpackages because they depends on James. Otherwise mailets running inside the second spoolmanager would still have the reference to the first mailetcontext and would send errors/new mail to the first spoolrepository. Summarizing: you have to open assembly.xml and duplicate the James, spoolmanager, matcherpackages, mailetpackages, smtpserver and spoolrepository blocks (altering their names and cross references, of course). Then you will have to do the same in config.xml (using the new names as tag names). I also use the ToSpoolRepository (see bottom of this mail) mailet to move a mail from one spoolrepository to the other. Stefano /*********************************************************************** * Copyright (c) 1999-2005 The Apache Software Foundation. * * All rights reserved. * * ------------------------------------------------------------------- * * Licensed under the Apache License, Version 2.0 (the "License"); you * * may not use this file except in compliance with the License. You * * may obtain a copy of the License at: * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * * implied. See the License for the specific language governing * * permissions and limitations under the License. * ***********************************************************************/ package org.apache.james.transport.mailets; import org.apache.avalon.cornerstone.services.store.Store; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.configuration.DefaultConfiguration; import org.apache.james.Constants; import org.apache.james.core.MailImpl; import org.apache.james.services.MailRepository; import org.apache.mailet.GenericMailet; import org.apache.mailet.Mail; import org.apache.mailet.MailetException; /** * Stores incoming Mail in the specified spool Repository. * If the "passThrough" in confs is true the mail will be returned untouched in * the pipe. If false will be destroyed. * If the "processor" conf is specified then the mail will be assigned to that * state before being stored, otherwise it will retain the current state. * * @version 1.0.0, 05/06/2005 * * @version This is $Revision: $ */ public class ToSpoolRepository extends GenericMailet { /** * The name of the processor to which this mailet forwards mail */ String processor; /** * The error message to attach to the forwarded message */ String noticeText = null; /** * The repository where this mailet stores mail. */ private MailRepository repository; /** * Whether this mailet should allow mails to be processed by additional mailets * or mark it as finished. */ private boolean passThrough = false; /** * The path to the repository */ private String repositoryPath; /** * Initialize the mailet, loading configuration information. */ public void init() throws MailetException { repositoryPath = getInitParameter("repositoryPath"); try { passThrough = new Boolean(getInitParameter("passThrough")).booleanValue(); } catch (Exception e) { // Ignore exception, default to false } ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER); try { Store mailstore = (Store) compMgr.lookup("org.apache.avalon.cornerstone.services.store.Store"); DefaultConfiguration mailConf = new DefaultConfiguration("repository", "generated:ToRepository"); mailConf.setAttribute("destinationURL", repositoryPath); mailConf.setAttribute("type", "SPOOL"); mailConf.setAttribute("CACHEKEYS", getInitParameter("CACHEKEYS") == null ? "TRUE" : getInitParameter("CACHEKEYS")); repository = (MailRepository) mailstore.select(mailConf); } catch (ServiceException cnfe) { log("Failed to retrieve Store component:" + cnfe.getMessage()); } catch (Exception e) { log("Failed to retrieve Store component:" + e.getMessage()); } processor = getInitParameter("processor"); noticeText = getInitParameter("notice"); } /** * Store a mail in a particular repository. * * @param mail the mail to process */ public void service(Mail genericmail) throws javax.mail.MessagingException { MailImpl mail = (MailImpl)genericmail; StringBuffer logBuffer = new StringBuffer(160) .append("Storing mail ") .append(mail.getName()) .append(" in ") .append(repositoryPath); log(logBuffer.toString()); String prevState = mail.getState(); if (processor!=null) mail.setState(processor); if (noticeText != null) { if (mail.getErrorMessage() == null) { mail.setErrorMessage(noticeText); } else { StringBuffer errorMessageBuffer = new StringBuffer(256) .append(mail.getErrorMessage()) .append("\r\n") .append(noticeText); mail.setErrorMessage(errorMessageBuffer.toString()); } } repository.store(mail); if (!passThrough) { mail.setState(Mail.GHOST); } else { mail.setState(prevState); } } /** * Return a string describing this mailet. * * @return a string describing this mailet */ public String getMailetInfo() { return "ToRepository Mailet"; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
