A prototype JavaMail resource adaptor that support message inflow to allow messages from a mail folder to be delivered to MDBs has been added to head. Deployment of the mail-ra.rar allows one to deploy JavaMail based MDBs as shown by this example code:
ejb-jar.xml: | <?xml version="1.0" encoding="UTF-8"?> | <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee | http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" | version="2.1"> | | <enterprise-beans> | | <message-driven> | <description>An MDB that accepts mail messages</description> | <ejb-name>MailMDB</ejb-name> | <ejb-class>org.jboss.test.jca.inflowmdb.TestJavaMailMDB</ejb-class> | <messaging-type>org.jboss.resource.adapter.mail.inflow.MailListener</messaging-type> | <activation-config> | <activation-config-property> | <activation-config-property-name>mailServer</activation-config-property-name> | <activation-config-property-value>${mailhost:mailhost}</activation-config-property-value> | </activation-config-property> | <activation-config-property> | <activation-config-property-name>mailFolder</activation-config-property-name> | <activation-config-property-value>INBOX</activation-config-property-value> | </activation-config-property> | <activation-config-property> | <activation-config-property-name>storeProtocol</activation-config-property-name> | <activation-config-property-value>imap</activation-config-property-value> | </activation-config-property> | <activation-config-property> | <activation-config-property-name>userName</activation-config-property-name> | <activation-config-property-value>jduke</activation-config-property-value> | </activation-config-property> | <activation-config-property> | <activation-config-property-name>password</activation-config-property-name> | <activation-config-property-value>theduke</activation-config-property-value> | </activation-config-property> | </activation-config> | <transaction-type>Container</transaction-type> | </message-driven> | </enterprise-beans> | </ejb-jar> | | jboss.xml: | <?xml version="1.0" encoding="UTF-8"?> | <!DOCTYPE jboss PUBLIC | "-//JBoss//DTD JBOSS 4.0//EN" | "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd"> | | <jboss> | <enterprise-beans> | <message-driven> | <ejb-name>MailMDB</ejb-name> | <resource-adapter-name>mail-ra.rar</resource-adapter-name> | </message-driven> | </enterprise-beans> | </jboss> | Sample MDB: | /* | * JBoss, the OpenSource J2EE webOS | * | * Distributable under LGPL license. | * See terms of license at gnu.org. | */ | package org.jboss.test.jca.inflowmdb; | | import javax.ejb.MessageDrivenBean; | import javax.ejb.MessageDrivenContext; | import javax.mail.Message; | | import org.jboss.resource.adapter.mail.inflow.MailListener; | import org.jboss.logging.Logger; | | /** | * A JavaMail based MDB. | * | * @author [EMAIL PROTECTED] | * @version $Revision: 1.1 $ | */ | public class TestJavaMailMDB | implements MessageDrivenBean, MailListener | { | private static Logger log = Logger.getLogger(TestJavaMailMDB.class); | | private MessageDrivenContext ctx; | | public void ejbCreate() | { | log.info("ejbCreate"); | } | | public void ejbRemove() | { | log.info("ejbRemove"); | } | | public void setMessageDrivenContext(MessageDrivenContext ctx) | { | this.ctx = ctx; | } | | public void onMessage(Message msg) | { | log.info("onMessage, msg="+msg); | } | } | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3855828#3855828 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3855828 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
