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 Andrew Gilbert <an...@soundbite.com> on 2004/01/21 20:49:03 UTC
Delaying Local Delivery, Configuring additional Spool type repositories?
We would like to be able to delay processing of a certain set of inbound
messages. Anyone have good ideas on how best do this. Possibilities seem
to be:
A. Modify /org/apache/james/transport/JamesSpoolManager.java to put a
delay into the accept() call for the inbound spool. This has the
disadvantage of delaying processing of all messages, not just a subset.
In addition we have to spin
a build of James, which isn't a big deal but is less convient than using
the Mailet API.
B. Write a matcher for the set of messages we want to delay, route them
to a custom processor. In that processor have
a custom Mailet which writes to a custom Spool repository and runs a
number of threads which then pluck from that
repository using an accept(delay) call.
Would prefer something akin to B, only not sure if it is possible or
straightforward to configure an additional spool and get a handle to it
inside our "Delay" mailet.
Any feedback welcome.
Using James 2.1.3 on Linux under JDK1.3.X.
Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: Delaying Local Delivery, Configuring additional Spool type repositories?
Posted by Andrew Gilbert <an...@soundbite.com>.
Andrew Gilbert wrote:
> Noel J. Bergman wrote:
>
>>> We would like to be able to delay processing of a certain set of
>>> inbound
>>> messages.
>>>
>>> B. Write a matcher for the set of messages we want to delay, route them
>>> to a custom processor. In that processor have a custom Mailet which
>>> writes to a custom Spool repository and runs a number of threads which
>>> then pluck from that repository using an accept(delay) call.
>>>
>>
>>
>> You want to use Plan B, and you want to base it off of the current
>> branch_2_1_fcs code, in which we made some changes related to the spool
>> interface. Write a custom mailet based upon RemoteDelivery that holds
>> messages in its queue until ready to deliver, then posts them back to
>> the
>> pipeline.
>>
>> --- Noel
>>
>>
>>
>>
> Was headed down the RemoteDelivery Plan B path, but I am getting these
> in the logs and my custom spool is not getting created.
> Would going to branch_2_1_fcs fix this? Or am I just missing something
> in the config or setup? Code snippet for creation is below as well.
>
> String spoolPath = getInitParameter("spool");
> if (spoolPath == null) {
> spoolPath = "file:///../var/mail/guidspool";
> }
>
> ComponentManager compMgr =
> (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
>
>
> try {
> // Instantiate a MailRepository for spooled mails
> MailStore mailstore = (MailStore)
> compMgr.lookup("org.apache.james.services.MailStore");
> DefaultConfiguration spoolConf
> = new DefaultConfiguration("repository",
> "generated:MsgGuidMailet.java");
> spoolConf.setAttribute("destinationURL", spoolPath);
> spoolConf.setAttribute("type", "SPOOL");
> this.spool = (SpoolRepository) mailstore.select(spoolConf);
> } catch (ComponentException cnfe) {
> log("Failed to retrieve Store component:" + cnfe.getMessage());
> } catch (Exception e) {
> log("Failed to retrieve Store component:" + e.getMessage());
> }
>
>
> 21/01/04 15:56:34 ERROR mailstore: Failed to retrieve Store
> component:Cannot find or init repository: null
> org.apache.avalon.framework.component.ComponentException: Cannot find
> or init repository: null
> at
> org.apache.avalon.cornerstone.blocks.masterstore.RepositoryManager.select(RepositoryManager.java:205)
>
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:92)
>
> at $Proxy1.select(Unknown Source)
> at
> org.apache.james.mailrepository.AvalonMailRepository.initialize(AvalonMailRepository.java:165)
>
> at
> org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:350)
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:92)
>
> at $Proxy3.select(Unknown Source)
> at COM.soundbite.mail.MsgGuidMailet.init(MsgGuidMailet.java:84)
> at org.apache.mailet.GenericMailet.init(GenericMailet.java:174)
>
> 21/01/04 15:56:34 INFO objectstorage.repository:
> org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository
> opened in /var/spool/mail/guidspool21/01/04 15:56:34 WARN
> objectstorage: Cannot find or init repository: null
> java.lang.NullPointerException
> at
> org.apache.james.mailrepository.filepair.AbstractFileRepository.initialize(AbstractFileRepository.java:168)
>
> at
> org.apache.avalon.cornerstone.blocks.masterstore.RepositoryManager.select(RepositoryManager.java:191)
>
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:92)
>
> at $Proxy1.select(Unknown Source)
> at
> org.apache.james.mailrepository.AvalonMailRepository.initialize(AvalonMailRepository.java:165)
>
> at
> org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:350
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
My bad yet again. Ouch. Was not picking up the new config.xml when
deploying my modified james.sar, and the default path of
"file:///../var/mail/guidspool" was unresolveable.
Thanks again!
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
RE: Delaying Local Delivery, Configuring additional Spool type repositories?
Posted by "Noel J. Bergman" <no...@devtech.com>.
> String spoolPath = getInitParameter("spool");
> if (spoolPath == null) {
> spoolPath = "file:///../var/mail/guidspool";
> }
I believe that the path is wrong, since it assumes that var/ is a peer of
the current directory. Just use "file://var/mail/guidspool".
> org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository
> opened in /var/spool/mail/guidspool21/01/04 15:56:34 WARN
> objectstorage: Cannot find or init repository: null
What does your <mailet> element contain?
> Would going to branch_2_1_fcs fix this?
It would let you use SpoolManager.accept(AcceptFilter).
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: Delaying Local Delivery, Configuring additional Spool type repositories?
Posted by Andrew Gilbert <an...@soundbite.com>.
Noel J. Bergman wrote:
>>We would like to be able to delay processing of a certain set of inbound
>>messages.
>>
>>
>>B. Write a matcher for the set of messages we want to delay, route them
>>to a custom processor. In that processor have a custom Mailet which
>>writes to a custom Spool repository and runs a number of threads which
>>then pluck from that repository using an accept(delay) call.
>>
>>
>
>You want to use Plan B, and you want to base it off of the current
>branch_2_1_fcs code, in which we made some changes related to the spool
>interface. Write a custom mailet based upon RemoteDelivery that holds
>messages in its queue until ready to deliver, then posts them back to the
>pipeline.
>
> --- Noel
>
>
>
>
Was headed down the RemoteDelivery Plan B path, but I am getting these
in the logs and my custom spool is not getting created.
Would going to branch_2_1_fcs fix this? Or am I just missing something
in the config or setup? Code snippet for creation is below as well.
String spoolPath = getInitParameter("spool");
if (spoolPath == null) {
spoolPath = "file:///../var/mail/guidspool";
}
ComponentManager compMgr =
(ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
try {
// Instantiate a MailRepository for spooled mails
MailStore mailstore = (MailStore)
compMgr.lookup("org.apache.james.services.MailStore");
DefaultConfiguration spoolConf
= new DefaultConfiguration("repository",
"generated:MsgGuidMailet.java");
spoolConf.setAttribute("destinationURL", spoolPath);
spoolConf.setAttribute("type", "SPOOL");
this.spool = (SpoolRepository) mailstore.select(spoolConf);
} catch (ComponentException cnfe) {
log("Failed to retrieve Store component:" + cnfe.getMessage());
} catch (Exception e) {
log("Failed to retrieve Store component:" + e.getMessage());
}
21/01/04 15:56:34 ERROR mailstore: Failed to retrieve Store
component:Cannot find or init repository: null
org.apache.avalon.framework.component.ComponentException: Cannot find or
init repository: null
at
org.apache.avalon.cornerstone.blocks.masterstore.RepositoryManager.select(RepositoryManager.java:205)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:92)
at $Proxy1.select(Unknown Source)
at
org.apache.james.mailrepository.AvalonMailRepository.initialize(AvalonMailRepository.java:165)
at
org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:350)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:92)
at $Proxy3.select(Unknown Source)
at COM.soundbite.mail.MsgGuidMailet.init(MsgGuidMailet.java:84)
at org.apache.mailet.GenericMailet.init(GenericMailet.java:174)
21/01/04 15:56:34 INFO objectstorage.repository:
org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository
opened in /var/spool/mail/guidspool21/01/04 15:56:34 WARN
objectstorage: Cannot find or init repository: null
java.lang.NullPointerException
at
org.apache.james.mailrepository.filepair.AbstractFileRepository.initialize(AbstractFileRepository.java:168)
at
org.apache.avalon.cornerstone.blocks.masterstore.RepositoryManager.select(RepositoryManager.java:191)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:92)
at $Proxy1.select(Unknown Source)
at
org.apache.james.mailrepository.AvalonMailRepository.initialize(AvalonMailRepository.java:165)
at
org.apache.james.core.AvalonMailStore.select(AvalonMailStore.java:350
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
RE: Delaying Local Delivery, Configuring additional Spool type repositories?
Posted by "Noel J. Bergman" <no...@devtech.com>.
> We would like to be able to delay processing of a certain set of inbound
> messages.
> B. Write a matcher for the set of messages we want to delay, route them
> to a custom processor. In that processor have a custom Mailet which
> writes to a custom Spool repository and runs a number of threads which
> then pluck from that repository using an accept(delay) call.
You want to use Plan B, and you want to base it off of the current
branch_2_1_fcs code, in which we made some changes related to the spool
interface. Write a custom mailet based upon RemoteDelivery that holds
messages in its queue until ready to deliver, then posts them back to the
pipeline.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org