Tips on MailListeners...
gohip May 29, 2006 3:49 PMHi All,
So, trying to get a MailListener going, without breaking the existing JMSMailListener, thus there would be the JMSMailListener and MyMailListener in the chain.
I copied JMSMailListener and JMSMailListenerMBean, renaming both to:
MyMailListener and MyMailListenerMBean
In JBoss-Service.xml, added(as well the JMSMailListener still exists)...
<!-- My JMS Mail Lisetner is used to asynchronously process mails, however the bodies are not stored via JMS as JBossMQ, the present JBosss messaging solution, doesn't do this efficiently. This is used for normal mail processing. --> <mbean code="org.jboss.mail.maillistener.MyMailListener" name="jboss.mail:type=MailServices,name=MyMailListener"> <constructor> <arg type="java.lang.String" value="java:/ConnectionFactory"/> <arg type="java.lang.String" value="java:/ConnectionFactory"/> </constructor> <depends>jboss.mq:service=DestinationManager</depends> <!-- <depends>jboss.management.local:j2eeType=JCAManagedConnectionFactory,name=JmsXA</depends>--> <depends>jboss.mq.destination:name=localMail,service=Queue</depends> <depends>jboss.mq.destination:name=remoteMail,service=Queue</depends> <depends optional-attribute-name="DomainGroup">jboss.mail:type=MailServices,name=DomainGroup,group=Local</depends> <!-- queue or topic --> <attribute name="DestinationType">queue</attribute> <!-- posts which are OnServer meaning they are for our domain and presumably a "local" user and won't go through an additional SMTP server should be sent here --> <attribute name="OnServerPostDestination">localMail</attribute> <!-- posts which are OffServer meaning they will go through an additional SMTP server before finally being received should go here --> <attribute name="OffServerPostDestination">remoteMail</attribute> <!-- Specifies the retry policy for failed local mail recipients. You can ... ... </mbean>
and
<mbean code="org.jboss.mail.MailListenerChainService" name="jboss.mail:type=MailServices,name=MailListenerChain" xmbean-dd="META-INF/chain-xmbean.xml"> <depends>jboss.mail:type=MailServices,name=MailListener</depends> <attribute name="Listeners"> <listeners> <!-- Uncomment to allow replies to go to Nukes <value>jboss.mail:type=MailServices,name=NukesPosterJMSListener</value> --> <listener>jboss.mail:type=MailServices,name=MailListener</listener> <listener>jboss.mail:type=MailServices,name=MyMailListener</listener> </listeners> </attribute> </mbean>
and
<!-- Mail Listener responsible for delivering mails to local mailboxes. --> <mbean code="org.jboss.mail.mailhandler.localmailbox.LocalDelivery" name="jboss.mail:type=MailServices,name=LocalDelivery"> <depends optional-attribute-name="MailboxManager" proxy-type="attribute">jboss.mail:type=MailServices,name=MailboxManager</depends> <depends optional-attribute-name="Router" proxy-type="org.jboss.mail.MailListener">jboss.mail:type=MailServices,name=MailListener</depends> <depends optional-attribute-name="Router" proxy-type="org.jboss.mail.MailListener">jboss.mail:type=MailServices,name=MyMailListener</depends> </mbean> <!-- Mail Listener chain for mails to be delivered locally. Any listeners that are specific to locally delivered mail should be added here. E.g. SPAM filtering. --> <mbean code="org.jboss.mail.MailListenerChainService" name="jboss.mail:type=MailServices,name=LocalDeliveryChain" xmbean-dd="META-INF/chain-xmbean.xml"> <depends>jboss.mail:type=MailServices,name=LocalDelivery</depends> <attribute name="Listeners"> <listeners> <listener>jboss.mail:type=MailServices,name=LocalDelivery</listener> </listeners> </attribute> </mbean>
The Application server loads the new MyMailListener fine, but when it begins to process a mail, after the original MailListener, it is erroring... did I miss something? Do I need a completely different queue, as the message no longer exists, but this doesnt seem correct in that the way you guys described the process, the first mail listener, returns the sent mail, for processing by the next (my)mail listener.
I know, Andrew, you were going to write up an Wiki on the subject, but havnt seen one or heard mention of em.
I searched forums, and as far as I can tell/find, I have done the correct first steps...So I thought I would start this thread, as others, might happen upon it, in their own attempts in making maillisteners...