Yong,

I don't know the answer to your question, but I thought I'd share with you something we learned on a past project:

We also *thought* it would be a good idea to have an MDB receive messages for the sake of queing up email to send (the MDB used the JavaMail api inside it), thinking it would return application flow back to the user faster. We learned it's not.

Using OptimizeIt!, we found the serialization of the objects sent to the MDB took longer than the actual time sending the email inside the onMessage method of the MDB. The MDB container had to serialize the objects, even though it was in the same JVM, since it needed to guarantee durability.

Just something for you to consider before you go too far down this path. The only thing you might be buying yourself is a slower, more complicated app - and maybe a little experience working with MDB's.

David

--

Kim, Yong escribió::
Hi,
I am really in a state of confusion with regards to JBossMQ, JMS & MDB. I
am not sure if my configuration is screwed up or the fact that I have
believed as true has turned out to be false! Please bear with me.

I have created a MDB called EmailManagerMDB. Currently, it has nothing in
it. It's basically a skeleton code. Inside the onMessage method, it only
has System.out.println method. I also created a stand-alone Java
application that sends a message to a queue called, "queue/EmailQueue" which
seems to be working fine. I have checked that this is working from
jmx-console. QueueDepth increases everytime I send a message.

Basically, the problem was that MDB wasn't being invoked when a message is
sent to the queue. The client code was sending a message to a queue called
"queue/EmailQueue" and the EmailManagerMDB was configured to listen to
"queue/EmailQueue" in the jboss.xml file. I have included both jboss.xml
and ejb-jar.xml files at the end of this email. I also have includes both
MDB and the client code.

Here is the dillema. The way I made the MDB gets invoked was that I changed
the client code to send the message to "queue/EmailManagerMDB" not
"queue/EmailQueue". Now, my state of confusion starts. First, when I
deployed the MDB, I got some strange message from the console saying,
"[JMSContainerInvoker] destination not found: queue/EmailManagerMDB reason:
javax.naming.NameNotFoundException: EmailManagerMDB not bound
[JMSContainerInvoker] creating a new temporary destination:
queue/EmailManagerMDB" I don't understand why I get this message. In the
jbossmq-destinations-service.xml, I have added following queue entry.

<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=EmailQueue">
<depends
optional-attribute-name="DestinationManager">jboss.mq:service=DestinationMan
ager</depends>
</mbean>
.

Why does JMSContainerInvoker creates this temporary queue when it was
configured to listen to "queue/EmailQueue". I thought that MDB listens to a
queue and it's onMessage method gets called when a messages get inserted
into the queue!

Am I wrong?

Thanks in advance.


Below is the jboss.xml file.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd";>

<jboss>

<enterprise-beans>

<session>
<ejb-name>com.kimion.ejb.ShoppingCartManagerBean</ejb-name>
<jndi-name>com/kimion/ejb/ShoppingCartManager</jndi-name>
<local-jndi-name>com/kimion/ejb/ShoppingCartManagerLocal</local-jndi-name>
</session>
<session>
<ejb-name>com.kimion.ejb.ProductManagerBean</ejb-name>
<jndi-name>com/kimion/ejb/ProductManager</jndi-name>
<local-jndi-name>com/kimion/ejb/ProductManagerLocal</local-jndi-name>
</session>
<session>
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<jndi-name>com/kimion/ejb/MemberManager</jndi-name>
<local-jndi-name>com/kimion/ejb/MemberManagerLocal</local-jndi-name>
</session>

<message-driven>
<ejb-name>EmailManagerMDB</ejb-name>
<destination-jndi-name>queue/EmailQueue</destination-jndi-name>
</message-driven>

</enterprise-beans>

<resource-managers>
</resource-managers>

</jboss>

And here is the ejb-jar.xml file.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd";>

<ejb-jar >

<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>

<enterprise-beans>

<!-- Session Beans -->
<session >
<description><![CDATA[Created Feb 25, 2002 2:07:04
PM]]></description>
<display-name>ShoppingCartBean</display-name>

<ejb-name>com.kimion.ejb.ShoppingCartManagerBean</ejb-name>

<home>com.kimion.ejb.ShoppingCartManagerHome</home>
<remote>com.kimion.ejb.ShoppingCartManager</remote>
<local-home>com.kimion.ejb.ShoppingCartManagerLocalHome</local-home>
<local>com.kimion.ejb.ShoppingCartManagerLocal</local>
<ejb-class>com.kimion.ejb.ShoppingCartManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</session>

<session >
<description><![CDATA[This EJB utilizes "Data Access Command Beans"
pattern.]]></description>
<display-name>ProductBean</display-name>

<ejb-name>com.kimion.ejb.ProductManagerBean</ejb-name>

<home>com.kimion.ejb.ProductManagerHome</home>
<remote>com.kimion.ejb.ProductManager</remote>
<local-home>com.kimion.ejb.ProductManagerLocalHome</local-home>
<local>com.kimion.ejb.ProductManagerLocal</local>
<ejb-class>com.kimion.ejb.ProductManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</session>

<session >
<description><![CDATA[This EJB utilizes "Data Access Command Beans"
pattern.]]></description>
<display-name>MemberBean</display-name>

<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>

<home>com.kimion.ejb.MemberManagerHome</home>
<remote>com.kimion.ejb.MemberManager</remote>
<local-home>com.kimion.ejb.MemberManagerLocalHome</local-home>
<local>com.kimion.ejb.MemberManagerLocal</local>
<ejb-class>com.kimion.ejb.MemberManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</session>

<!--
To add session beans that you have deployment descriptor info for,
add
a file to your XDoclet merge directory called session-beans.xml that
contains
the <session></session> markup for those beans.
-->

<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that
contains
the <entity></entity> markup for those beans.
-->

<!-- Message Driven Beans -->
<message-driven >
<description><![CDATA[Message Driven Bean that listens to
EmailQueue.]]></description>
<display-name>EmailManager Message Driven Bean</display-name>

<ejb-name>EmailManagerMDB</ejb-name>

<ejb-class>com.kimion.ejb.EmailManagerMDB</ejb-class>

<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
<subscription-durability>NonDurable</subscription-durability>
</message-driven-destination>

</message-driven>

<!--
To add message driven beans that you have deployment descriptor info
for, add
a file to your XDoclet merge directory called
message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->

</enterprise-beans>

<!-- Relationships -->

<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->

<!-- finder permissions -->

<!-- finder permissions -->

<!-- finder permissions -->

<!-- finder permissions -->

<!-- transactions -->
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.ShoppingCartManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>getPassword</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.ShoppingCartManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPassword</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.ProductManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>addProduct</method-name>
<method-params>
<method-param>com.kimion.business.component.Product</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.ProductManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>addProduct</method-name>
<method-params>
<method-param>com.kimion.business.component.Product</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.ProductManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>getProductsByCategory</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.ProductManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getProductsByCategory</method-name>
<method-params>
<method-param>int</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>addMember</method-name>
<method-params>
<method-param>com.kimion.business.component.Member</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>addMember</method-name>
<method-params>
<method-param>com.kimion.business.component.Member</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>getPassword</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPassword</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>sendEmail</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>sendEmail</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Local</method-intf>
<method-name>sendMassEmail</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
<container-transaction >
<method >
<ejb-name>com.kimion.ejb.MemberManagerBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>sendMassEmail</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>

<!-- finder transactions -->
</assembly-descriptor>

</ejb-jar>



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to