User: pra     
  Date: 01/04/10 03:41:17

  Modified:    src/docs howtomdb.xml
  Log:
  Changed some erounous deployment descriptor examples
  
  Revision  Changes    Path
  1.3       +315 -312  manual/src/docs/howtomdb.xml
  
  Index: howtomdb.xml
  ===================================================================
  RCS file: /cvsroot/jboss/manual/src/docs/howtomdb.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- howtomdb.xml      2001/03/21 08:30:20     1.2
  +++ howtomdb.xml      2001/04/10 10:41:17     1.3
  @@ -27,52 +27,54 @@
                                <para>Write the ejb-jar.xml descriptor.</para>     
                                <para>Here is an example for a bean listening on a 
queue with bean managed transactions :</para>
                                <programlisting><![CDATA[
  -     <?xml version="1.0"?>
  -     <!DOCTYPE ejb-jar>
  -     <!--
  +    <?xml version="1.0"?>
  +    <!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>
  -         <enterprise-beans>
  -           <message-driven>
  -             <ejb-name>QueueBean</ejb-name>
  -             <ejb-class>org.jboss.test.mdb.bean.QueueBean</ejb-class>
  -             <message-selector></message-selector>
  -             <transaction-type>Bean</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>
  -     </enterprise-beans>
  -     </ejb-jar>
  +    <ejb-jar>
  +      <enterprise-beans>
  +        <message-driven>
  +          <ejb-name>QueueBean</ejb-name>
  +          <ejb-class>org.jboss.test.mdb.bean.QueueBean</ejb-class>
  +          <message-selector></message-selector>
  +          <transaction-type>Bean</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>
  +      </enterprise-beans>
  +    </ejb-jar>
   ]]></programlisting>     
                                <para>     And here are one for a durable topic with 
container managed transactions:</para>
                                <programlisting><![CDATA[
        <?xml version="1.0"?>
        <!DOCTYPE ejb-jar>
  -     <message-driven>
  +     <ejb-jar>
  +       <enterprise-beans>
  +         <message-driven>
  +           <ejb-name>DurableTopicBean</ejb-name>
  +           <ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
  +           <message-selector></message-selector>
  +           <transaction-type>Container</transaction-type>
  +           <message-driven-destination>
  +             <destination-type>javax.jms.Topic</destination-type>
  +             <subscription-durability>Durable</subscription-durability>
  +           </message-driven-destination>
  +         </message-driven>
  +       </enterprise-beans>
  +       <assembly-descriptor>
  +         <container-transaction>
  +           <method>
                <ejb-name>DurableTopicBean</ejb-name>
  -             <ejb-class>org.jboss.test.mdb.bean.TopicBean</ejb-class>
  -             <message-selector></message-selector>
  -              <transaction-type>Container</transaction-type>
  -             <message-driven-destination>
  -                 <destination-type>javax.jms.Topic</destination-type>
  -                 <subscription-durability>Durable</subscription-durability>
  -             </message-driven-destination>
  -           </message-driven>
  -         </enterprise-beans>
  -         <assembly-descriptor>
  -           <container-transaction>
  -            <method>
  -              <ejb-name>DurableTopicBean</ejb-name>
  -              <method-name>*</method-name>
  -            </method>
  +             <method-name>*</method-name>
  +           </method>
               <trans-attribute>Required</trans-attribute>
  -            </container-transaction>
  -        </assembly-descriptor>
  +           </container-transaction>
  +       </assembly-descriptor>
        </ejb-jar>
   ]]></programlisting>
                        </listitem>
  @@ -108,6 +110,7 @@
                 <mdb-passwd>needle</mdb-passwd>
                 <mdb-client-id>DurableSubscriberExample</mdb-client-id>
               </message-driven>
  +          </enterprise-beans>
        </jboss>
   ]]></programlisting>
                        </listitem>
  @@ -116,27 +119,27 @@
          </para>     
                                <para>Eg:</para>
                                <programlisting><![CDATA[
  -             <Queue>
  -                     <Name>testQueue</Name>
  -             </Queue>
  +     <Queue>
  +       <Name>testQueue</Name>
  +     </Queue>
   ]]></programlisting>
                                <para>     For the queue, and </para>
                                <programlisting><![CDATA[
  -             <Topic>
  -                     <Name>testDurableTopic</Name>
  -             </Topic>
  +      <Topic>
  +        <Name>testDurableTopic</Name>
  +      </Topic>
   ]]></programlisting>
                                <para>plus</para>
                                <programlisting><![CDATA[
  -                      <User>
  -                             <Name>john</Name>
  -                             <Password>needle</Password>
  -                             <Id>DurableSubscriberExample</Id>
  -                             <DurableSubscription>
  -                                     <Name>DurableSubscriberExample</Name>
  -                                     <TopicName>testDurableTopic</TopicName>
  -                             </DurableSubscription>
  -                     </User>
  +     <User>
  +       <Name>john</Name>
  +       <Password>needle</Password>
  +       <Id>DurableSubscriberExample</Id>
  +       <DurableSubscription>
  +         <Name>DurableSubscriberExample</Name>
  +         <TopicName>testDurableTopic</TopicName>
  +       </DurableSubscription>
  +     </User>
   ]]></programlisting>
                                <para>for the durable topic.</para>
                        </listitem>
  @@ -157,7 +160,7 @@
                                <para>Decouple an invoker from the invoked code.</para>
                        </listitem>
                        <listitem>
  -                             <para>Make it possible for multiple parties to get you 
messages.</para>
  +                             <para>Make it possible for multiple parties to get 
your messages.</para>
                        </listitem>
                        <listitem>
                                <para>Get asynchronous behavior, i.e. start long 
running code without the need to wait for the call to return.</para>
  @@ -217,41 +220,42 @@
                        <programlisting><![CDATA[
        <?xml version="1.0"?>
        <!DOCTYPE ejb-jar>
  -     <message-driven>
  -             <ejb-name>MDB</ejb-name>
  -             <ejb-class>test.bean.MDB</ejb-class>
  -             <message-selector></message-selector>
  -              <transaction-type>Container</transaction-type>
  -             <message-driven-destination>
  -                 <destination-type>javax.jms.Topic</destination-type>
  -                 <subscription-durability>NonDurable</subscription-durability>
  -             </message-driven-destination>
  -           </message-driven>
  -         </enterprise-beans>
  -         <assembly-descriptor>
  -           <container-transaction>
  -            <method>
  -              <ejb-name>DurableTopicBean</ejb-name>
  -              <method-name>*</method-name>
  -            </method>
  -            <trans-attribute>NotRequired</trans-attribute>
  -            </container-transaction>
  -        </assembly-descriptor>
  +     <ejb-jar>
  +       <enterprise-beans>
  +         <message-driven>
  +           <ejb-name>MDB</ejb-name>
  +           <ejb-class>test.bean.MDB</ejb-class>
  +           <message-selector></message-selector>
  +           <transaction-type>Container</transaction-type>
  +           <message-driven-destination>
  +             <destination-type>javax.jms.Topic</destination-type>
  +             <subscription-durability>NonDurable</subscription-durability>
  +           </message-driven-destination>
  +         </message-driven>
  +       </enterprise-beans>
  +       <assembly-descriptor>
  +         <container-transaction>
  +           <method>
  +             <ejb-name>DurableTopicBean</ejb-name>
  +             <method-name>*</method-name>
  +           </method>
  +           <trans-attribute>NotRequired</trans-attribute>
  +         </container-transaction>
  +       </assembly-descriptor>
        </ejb-jar>
   ]]></programlisting>
                        <para>We also need to write a small deployment descriptor that 
is specific for JBoss. The full version of this is quite big, and with it it is 
possible to configure the MDB container quite a bit. For most users this is not 
necessary, and the may use the standard configuration. The most important part of the 
descriptor is the specification of the destination. We chose the testTopic since it is 
always available in JBoss.</para>
                        <programlisting><![CDATA[
   
        <?xml version="1.0" encoding="Cp1252"?>
  -
        <jboss>
  -          <enterprise-beans>
  -            <message-driven>
  -              <ejb-name>MDB</ejb-name>
  -              <configuration-name>Standard Message Driven Bean</configuration-name>
  -              <destination-jndi-name>test/testTopic</destination-jndi-name>
  -            </message-driven>
  -          </enterprise-beans>
  +       <enterprise-beans>
  +         <message-driven>
  +           <ejb-name>MDB</ejb-name>
  +           <configuration-name>Standard Message Driven Bean</configuration-name>
  +           <destination-jndi-name>topic/testTopic</destination-jndi-name>
  +         </message-driven>
  +       </enterprise-beans>
        </jboss>
   ]]></programlisting>
                        <para>Then you will have to pack these into a jar. Here is one 
way to do it:</para>
  @@ -438,105 +442,105 @@
   ]]></programlisting>
                        <para>To deploy this into JBoss we need to write two 
deployment descriptors, one standard ejb, and one for JBoss. Lets begin with the 
standard one. For ease of use we include both beans into one jar. For the Message 
Driven Bean we have to decide if its a topic or not, and what kind of transactions it 
should run under. In this case we chose a topic and container managed transaction. We 
also have to specify an ejb-ref so that the listener can lookup the home of the 
WorkerBean:</para>
                        <programlisting><![CDATA[
  - <message-driven>
  -     <ejb-name>ListenerBean</ejb-name>
  -     <ejb-class>msgbean.server.ListenerBean</ejb-class>
  -        <message-selector></message-selector>
  -        <transaction-type>Container</transaction-type>
  -        <ejb-ref>
  -       <description>The Workers home</description>
  -       <ejb-ref-name>ejb/worker</ejb-ref-name>
  -       <ejb-ref-type>Session</ejb-ref-type>
  -          <ejb-link>WorkerBean</ejb-link>
  -       <home>msgbean.interfaces.WorkerHome</home>
  -       <remote>msgbean.interfaces.Worker</remote>
  -        </ejb-ref>
  -         <message-driven-destination>
  -            <destination-type>javax.jms.Topic</destination-type>
  -            <subscription-durability>NonDurable</subscription-durability>
  -        </message-driven-destination>
  -      </message-driven>
  +     <message-driven>
  +       <ejb-name>ListenerBean</ejb-name>
  +       <ejb-class>msgbean.server.ListenerBean</ejb-class>
  +       <message-selector></message-selector>
  +       <transaction-type>Container</transaction-type>
  +       <ejb-ref>
  +         <description>The Workers home</description>
  +      <ejb-ref-name>ejb/worker</ejb-ref-name>
  +      <ejb-ref-type>Session</ejb-ref-type>
  +         <ejb-link>WorkerBean</ejb-link>
  +      <home>msgbean.interfaces.WorkerHome</home>
  +      <remote>msgbean.interfaces.Worker</remote>
  +       </ejb-ref>
  +       <message-driven-destination>
  +         <destination-type>javax.jms.Topic</destination-type>
  +         <subscription-durability>NonDurable</subscription-durability>
  +       </message-driven-destination>
  +     </message-driven>
   ]]></programlisting>
                        <para>We also have to ad an entry for the Worker bean:</para>
                        <programlisting><![CDATA[
  -<session>
  -        <description>Worker bean</description>
  -        <display-name>Worker</display-name>
  -        <ejb-name>WorkerBean</ejb-name>
  -        <home>msgbean.interfaces.WorkerHome</home>
  -        <remote>msgbean.interfaces.Worker</remote>
  -        <ejb-class>msgbean.server.WorkerBean</ejb-class>
  -        <session-type>Stateless</session-type>
  -        <transaction-type>Container</transaction-type>
  +     <session>
  +       <description>Worker bean</description>
  +       <display-name>Worker</display-name>
  +       <ejb-name>WorkerBean</ejb-name>
  +       <home>msgbean.interfaces.WorkerHome</home>
  +       <remote>msgbean.interfaces.Worker</remote>
  +       <ejb-class>msgbean.server.WorkerBean</ejb-class>
  +       <session-type>Stateless</session-type>
  +       <transaction-type>Container</transaction-type>
         </session>
   ]]></programlisting>
                        <para>Here is the complete deployment descriptor, including 
defintions of the transaction type.</para>
                        <programlisting><![CDATA[
  -<!DOCTYPE ejb-jar>
  -<ejb-jar>
  -    <enterprise-beans>
  -
  -      <message-driven>
  -     <ejb-name>ListenerBean</ejb-name>
  -     <ejb-class>msgbean.server.ListenerBean</ejb-class>
  -        <message-selector></message-selector>
  -        <transaction-type>Container</transaction-type>
  -        <ejb-ref>
  -       <description>The Workers home</description>
  -       <ejb-ref-name>ejb/worker</ejb-ref-name>
  -       <ejb-ref-type>Session</ejb-ref-type>
  -          <ejb-link>WorkerBean</ejb-link>
  -       <home>msgbean.interfaces.WorkerHome</home>
  -       <remote>msgbean.interfaces.Worker</remote>
  -        </ejb-ref>
  -         <message-driven-destination>
  +     <!DOCTYPE ejb-jar>
  +     <ejb-jar>
  +       <enterprise-beans>
  +
  +        <message-driven>
  +       <ejb-name>ListenerBean</ejb-name>
  +       <ejb-class>msgbean.server.ListenerBean</ejb-class>
  +          <message-selector></message-selector>
  +          <transaction-type>Container</transaction-type>
  +          <ejb-ref>
  +         <description>The Workers home</description>
  +         <ejb-ref-name>ejb/worker</ejb-ref-name>
  +         <ejb-ref-type>Session</ejb-ref-type>
  +            <ejb-link>WorkerBean</ejb-link>
  +         <home>msgbean.interfaces.WorkerHome</home>
  +         <remote>msgbean.interfaces.Worker</remote>
  +           </ejb-ref>
  +           <message-driven-destination>
               <destination-type>javax.jms.Topic</destination-type>
               <subscription-durability>NonDurable</subscription-durability>
  -        </message-driven-destination>
  -      </message-driven>
  -      <session>
  -        <description>Worker bean</description>
  -        <display-name>Worker</display-name>
  -        <ejb-name>WorkerBean</ejb-name>
  -        <home>msgbean.interfaces.WorkerHome</home>
  -        <remote>msgbean.interfaces.Worker</remote>
  -        <ejb-class>msgbean.server.WorkerBean</ejb-class>
  -        <session-type>Stateless</session-type>
  -        <transaction-type>Container</transaction-type>
  -      </session>
  -    </enterprise-beans>
  -    <assembly-descriptor>
  -     <container-transaction>
  -       <method>
  -         <ejb-name>ListenerBean</ejb-name>
  -         <method-name>*</method-name>
  -       </method>
  -     <trans-attribute>Required</trans-attribute>
  -     </container-transaction>
  -     <container-transaction>
  -      <method>
  -     <ejb-name>WorkerBean</ejb-name>
  -     <method-intf>Remote</method-intf>
  -     <method-name>*</method-name>
  -      </method>
  -      <trans-attribute>Required</trans-attribute>
  -    </container-transaction>
  -    </assembly-descriptor>
  -  </ejb-jar>
  +           </message-driven-destination>
  +         </message-driven>
  +         <session>
  +           <description>Worker bean</description>
  +           <display-name>Worker</display-name>
  +           <ejb-name>WorkerBean</ejb-name>
  +           <home>msgbean.interfaces.WorkerHome</home>
  +           <remote>msgbean.interfaces.Worker</remote>
  +           <ejb-class>msgbean.server.WorkerBean</ejb-class>
  +           <session-type>Stateless</session-type>
  +           <transaction-type>Container</transaction-type>
  +         </session>
  +       </enterprise-beans>
  +       <assembly-descriptor>
  +       <container-transaction>
  +         <method>
  +           <ejb-name>ListenerBean</ejb-name>
  +           <method-name>*</method-name>
  +         </method>
  +         <trans-attribute>Required</trans-attribute>
  +       </container-transaction>
  +       <container-transaction>
  +         <method>
  +        <ejb-name>WorkerBean</ejb-name>
  +        <method-intf>Remote</method-intf>
  +        <method-name>*</method-name>
  +         </method>
  +         <trans-attribute>Required</trans-attribute>
  +       </container-transaction>
  +     </assembly-descriptor>
  +   </ejb-jar>
   ]]></programlisting>
                        <para>We also need to write a jboss.xml deployment descriptor. 
This is needed because it the destination JNDI name must be defined somewhere. Here we 
can not use on a default.</para>
                        <programlisting><![CDATA[
  -<?xml version="1.0" encoding="Cp1252"?>
  -<jboss>
  -   <enterprise-beans>
  -       <message-driven>
  -         <ejb-name>ListenerBean</ejb-name>
  -              <configuration-name>Standard Message Driven Bean</configuration-name>
  -         <destination-jndi-name>topic/testTopic</destination-jndi-name>
  -       </message-driven>
  -       <secure>false</secure>
  -   </enterprise-beans>
  -</jboss>
  +     <?xml version="1.0" encoding="Cp1252"?>
  +     <jboss>
  +       <enterprise-beans>
  +         <message-driven>
  +           <ejb-name>ListenerBean</ejb-name>
  +           <configuration-name>Standard Message Driven Bean</configuration-name>
  +           <destination-jndi-name>topic/testTopic</destination-jndi-name>
  +         </message-driven>
  +         <secure>false</secure>
  +       </enterprise-beans>
  +     </jboss>
   ]]></programlisting>
                        <para>We then have to compile the beans. You will have to add 
several jar-files to your class-path to have success with this. Among the most 
important, and special for MDB, is that you will need ejb2.0 from lib/ext to be able 
to compile. You also need to pack them into a jar-file. Do this as described above. 
Deploy by copying the jar-file to deploy. You may use the example publisher above to 
publish messages to the bean.</para>
                </section>
  @@ -654,62 +658,62 @@
   ]]></programlisting>
                        <para>The deployment descriptors for this bean follows the 
normal way to write them, except that you will have to add entries for the 
resource-ref. Here is the ejb deployment descriptor:</para>
                        <programlisting><![CDATA[
  -<?xml version="1.0"?>
  -<!DOCTYPE ejb-jar>
  -<ejb-jar>
  -    <enterprise-beans>
  -      <message-driven>
  -     <ejb-name>JmsAdapter</ejb-name>
  -     <ejb-class>javaclients.j2ee.k2.JmsAdapter</ejb-class>
  -        <message-selector></message-selector>
  -         <transaction-type>Container</transaction-type>
  -        <resource-ref>
  -               <res-ref-name>xmlBlaster</res-ref-name>
  -               
<res-type>org.xmlBlaster.j2ee.k2.client.BlasterConnectionFactory</res-type>
  -               <res-auth>Container</res-auth>
  -        </resource-ref>
  -        <message-driven-destination>
  -            <destination-type>javax.jms.Topic</destination-type>
  -            <subscription-durability>NonDurable</subscription-durability>
  -        </message-driven-destination>
  -      </message-driven>
  -    </enterprise-beans>
  -    <assembly-descriptor>
  -     <container-transaction>
  -       <method>
  -         <ejb-name>JmsAdapter</ejb-name>
  -         <method-name>*</method-name>
  -       </method>
  -       <trans-attribute>Required</trans-attribute>
  -     </container-transaction>
  -    </assembly-descriptor>
  -  </ejb-jar>
  +     <?xml version="1.0"?>
  +     <!DOCTYPE ejb-jar>
  +     <ejb-jar>
  +       <enterprise-beans>
  +         <message-driven>
  +        <ejb-name>JmsAdapter</ejb-name>
  +        <ejb-class>javaclients.j2ee.k2.JmsAdapter</ejb-class>
  +           <message-selector></message-selector>
  +           <transaction-type>Container</transaction-type>
  +           <resource-ref>
  +             <res-ref-name>xmlBlaster</res-ref-name>
  +             
<res-type>org.xmlBlaster.j2ee.k2.client.BlasterConnectionFactory</res-type>
  +             <res-auth>Container</res-auth>
  +           </resource-ref>
  +         <message-driven-destination>
  +           <destination-type>javax.jms.Topic</destination-type>
  +           <subscription-durability>NonDurable</subscription-durability>
  +         </message-driven-destination>
  +       </message-driven>
  +     </enterprise-beans>
  +     <assembly-descriptor>
  +       <container-transaction>
  +         <method>
  +           <ejb-name>JmsAdapter</ejb-name>
  +           <method-name>*</method-name>
  +         </method>
  +         <trans-attribute>Required</trans-attribute>
  +       </container-transaction>
  +     </assembly-descriptor>
  +   </ejb-jar>
   ]]></programlisting>
                        <para>And here is the jboss.xml descriptor:</para>
                        <programlisting><![CDATA[
  -<?xml version="1.0" encoding="Cp1252"?>
  +     <?xml version="1.0" encoding="Cp1252"?>
   
  -<jboss>
  -    <resource-managers>
  -        <resource-manager>
  -          <res-name>xmlBlaster</res-name>
  -          <res-jndi-name>java:/XmlBlasterDS</res-jndi-name>
  -    </resource-manager>
  -    </resource-managers>
  -     <enterprise-beans>
  -       <message-driven>
  -         <ejb-name>JmsAdapter</ejb-name>
  -      <configuration-name>Standrad Message Driven Bean</configuration-name>
  -
  -         <destination-jndi-name>topic/testTopic</destination-jndi-name>
  -          <resource-ref>
  -           <res-ref-name>xmlBlaster</res-ref-name>
  -           <resource-name>xmlBlaster</resource-name>
  -         </resource-ref>
  -       </message-driven>
  -        <secure>false</secure>
  -     </enterprise-beans>
  - </jboss>
  +     <jboss>
  +       <resource-managers>
  +         <resource-manager>
  +           <res-name>xmlBlaster</res-name>
  +           <res-jndi-name>java:/XmlBlasterDS</res-jndi-name>
  +         </resource-manager>
  +       </resource-managers>
  +       <enterprise-beans>
  +         <message-driven>
  +           <ejb-name>JmsAdapter</ejb-name>
  +        <configuration-name>Standrad Message Driven Bean</configuration-name>
  +
  +           <destination-jndi-name>topic/testTopic</destination-jndi-name>
  +           <resource-ref>
  +             <res-ref-name>xmlBlaster</res-ref-name>
  +             <resource-name>xmlBlaster</resource-name>
  +           </resource-ref>
  +         </message-driven>
  +         <secure>false</secure>
  +       </enterprise-beans>
  +     </jboss>
   ]]></programlisting>
                </section>
        </section>
  @@ -724,53 +728,52 @@
                                <listitem>
                                        <para>A bean may be either a javax.jms.Topic 
or a javax.jms.Queue bean, which is decided in the stanza "destination-type", 
eg.</para>
                                        <programlisting><![CDATA[
  -         <message-driven-destination>
  -            <destination-type>javax.jms.Queue</destination-type>
  -            <subscription-durability>NonDurable</subscription-durability>
  -        </message-driven-destination>
  +     <message-driven-destination>
  +       <destination-type>javax.jms.Queue</destination-type>
  +       <subscription-durability>NonDurable</subscription-durability>
  +     </message-driven-destination>
   
   ]]></programlisting>
                                </listitem>
                                <listitem>
                                        <para>If a bean is a Topic it may be either 
NonDurable or Durable, wich is described in the stanza 
"subscription-durability".</para>
                                        <programlisting><![CDATA[
  -        <message-driven-destination>
  -            <destination-type>javax.jms.Topic</destination-type>
  -            <subscription-durability>Durable</subscription-durability>
  -        </message-driven-destination>
  +     <message-driven-destination>
  +       <destination-type>javax.jms.Topic</destination-type>
  +       <subscription-durability>Durable</subscription-durability>
  +     </message-driven-destination>
   ]]></programlisting>
                                </listitem>
                                <listitem>
                                        <para>A bean may be have transaction either as 
bean managed or container managed, which is described in the stanza 
"transaction-type", eg.</para>
                                        <programlisting><![CDATA[
  -<transaction-type>Container</transaction-type>
  +     <transaction-type>Container</transaction-type>
   ]]></programlisting>
                                </listitem>
                                <listitem>
                                        <para>A bean managed bean may have an 
acknowledge type of either AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE. This is currently 
not supported in JBoss since the container always are receiving messages under a 
transaction. But it is described in the stanza "acknowledge-mode".</para>
                                        <programlisting><![CDATA[
  -        <transaction-type>Bean</transaction-type>
  -        <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
  +     <transaction-type>Bean</transaction-type>
  +     <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
   ]]></programlisting>
                                </listitem>
                                <listitem>
                                        <para>A container managed bean may either 
specify transactions as Required or NotSupported, which is done in the 
container-transaction transaction part.</para>
                                        <programlisting><![CDATA[
  -    </container-transaction>
  -          <container-transaction>
  +     <container-transaction>
          <method>
            <ejb-name>DurableTopicBean</ejb-name>
            <method-name>*</method-name>
          </method>
        <!-- May also be NotSupported -->
  -     <trans-attribute>Required</trans-attribute>
  +       <trans-attribute>Required</trans-attribute>
        </container-transaction>
   ]]></programlisting>
                                </listitem>
                                <listitem>
                                        <para>An MDB may also specify a selector which 
follows the JMS syntax for a selector. Which is specified in the stanza 
"message-selector".</para>
                                        <programlisting><![CDATA[
  -<message-selector>JMSType='activityCompletion'</message-selector>
  +     <message-selector>JMSType='activityCompletion'</message-selector>
   ]]></programlisting>
                                </listitem>
                        </itemizedlist>
  @@ -785,72 +788,72 @@
   ]]></programlisting>
                        <para>You also have to tell the beans name and the name of the 
container configuration. To use the one in standardjboss.xml you should give the name 
"Standard Message Driven Bean".</para>
                        <programlisting><![CDATA[
  - <message-driven>
  -         <ejb-name>QueueBean</ejb-name>
  -         <configuration-name>Standard Message Driven Bean</configuration-name>
  -         <destination-jndi-name>queue/testQueue</destination-jndi-name>
  -  </message-driven>
  +     <message-driven>
  +       <ejb-name>QueueBean</ejb-name>
  +       <configuration-name>Standard Message Driven Bean</configuration-name>
  +       <destination-jndi-name>queue/testQueue</destination-jndi-name>
  +     </message-driven>
   ]]></programlisting>
                        <para>It is also possible to use a name and a password to log 
in to JBossMQ. These may be used by them self. If you have specified a Durable Topic 
they are however required. Then one also have to specify a client-id. All these stuff 
are configurable in conf/default/jbossmq.xml. Using one of the default in that file we 
could have a deployment descriptor looking like this:</para>
                        <programlisting><![CDATA[
  -  <message-driven>
  -     <ejb-name>DurableTopicBean</ejb-name>
  -     <configuration-name>Standard Message Driven Bean</configuration-name>
  -     <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
  -     <mdb-user>john</mdb-user>
  -     <mdb-passwd>needle</mdb-passwd>
  -     <mdb-client-id>DurableSubscriberExample</mdb-client-id>
  -   </message-driven>
  +     <message-driven>
  +       <ejb-name>DurableTopicBean</ejb-name>
  +       <configuration-name>Standard Message Driven Bean</configuration-name>
  +       <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
  +       <mdb-user>john</mdb-user>
  +       <mdb-passwd>needle</mdb-passwd>
  +       <mdb-client-id>DurableSubscriberExample</mdb-client-id>
  +     </message-driven>
   ]]></programlisting>
                        <para>The container stuff for MDB are in standardjboss.xml. It 
is however possible to override this configuration by including it in the jboss.xml 
deployment descriptor. I will first give you the complete look if doing like this, and 
then go through the individual entries.</para>
                        <programlisting><![CDATA[
  -<?xml version="1.0" encoding="Cp1252"?>
  -<jboss>
  -   <enterprise-beans>
  -       <message-driven>
  -         <ejb-name>ObjectMessageBean</ejb-name>
  -         <configuration-name>My Config</configuration-name>
  -         <destination-jndi-name>queue/testObjectMessage</destination-jndi-name>
  -       </message-driven>
  -       <secure>false</secure>
  -   </enterprise-beans>
  -   <container-configurations>
  -       <container-configuration>
  -            <container-name>My Config</container-name>
  -            <call-logging>false</call-logging>
  -            
<container-invoker>org.jboss.ejb.plugins.jms.JMSContainerInvoker</container-invoker>
  -            <container-interceptors>
  -                <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
  -                <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
  -                <!-- CMT -->
  -                <interceptor 
transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
  -                <interceptor transaction="Container" 
metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
  -                <interceptor 
transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
  -                <!-- BMT -->
  -                <interceptor 
transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
  -                <interceptor 
transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
  -                <interceptor transaction="Bean" 
metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
  -            </container-interceptors>
  -            
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
  -            <instance-cache></instance-cache>
  -            <persistence-manager></persistence-manager>
  -            <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
  -            <container-invoker-conf>
  -                     
<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
  -                     
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
  -                     <MaximumSize>15</MaximumSize>
  -                     <MaxMessages>1</MaxMessages>
  -             <Optimized>True</Optimized>
  -            </container-invoker-conf>
  -            <container-pool-conf>
  -            <MaximumSize>100</MaximumSize>
  -            <MinimumSize>10</MinimumSize>
  -            </container-pool-conf>
  -        </container-configuration>
  -
  -    </container-configurations>
  -    <resource-managers />
  -   </container-configurations>
  +     <?xml version="1.0" encoding="Cp1252"?>
  +     <jboss>
  +       <enterprise-beans>
  +         <message-driven>
  +           <ejb-name>ObjectMessageBean</ejb-name>
  +           <configuration-name>My Config</configuration-name>
  +           <destination-jndi-name>queue/testObjectMessage</destination-jndi-name>
  +         </message-driven>
  +         <secure>false</secure>
  +       </enterprise-beans>
  +       <container-configurations>
  +         <container-configuration>
  +           <container-name>My Config</container-name>
  +           <call-logging>false</call-logging>
  +           
<container-invoker>org.jboss.ejb.plugins.jms.JMSContainerInvoker</container-invoker>
  +           <container-interceptors>
  +             <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
  +             <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
  +             <!-- CMT -->
  +             <interceptor 
transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
  +             <interceptor transaction="Container" 
metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
  +             <interceptor 
transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
  +             <!-- BMT -->
  +             <interceptor 
transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
  +             <interceptor 
transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
  +             <interceptor transaction="Bean" 
metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
  +           </container-interceptors>
  +           
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
  +           <instance-cache></instance-cache>
  +           <persistence-manager></persistence-manager>
  +           <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
  +           <container-invoker-conf>
  +             <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
  +             <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
  +             <MaximumSize>15</MaximumSize>
  +             <MaxMessages>1</MaxMessages>
  +             <Optimized>True</Optimized>
  +           </container-invoker-conf>
  +           <container-pool-conf>
  +             <MaximumSize>100</MaximumSize>
  +             <MinimumSize>10</MinimumSize>
  +           </container-pool-conf>
  +         </container-configuration>
  +
  +       </container-configurations>
  +       <resource-managers />
  +     </jboss>
   ]]></programlisting>
                        <para>Here we go through some ways to configure the MDB 
container</para>
                        <section>
  @@ -865,46 +868,46 @@
                                <title>Container invoker configuration</title>
                                <para>This is probably the most interesting part to 
understand. Lets look at it in smaller pieces. First it defines a 
"JMSProviderAdapterJNDI":</para>
                                <programlisting><![CDATA[
  -<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
  +     <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
   ]]></programlisting>
                                <para>There should be a JNDI name to a JMX bean where 
one might lookup a provider adapter class. This class is then used by the invoker to 
find the names of the connection factories, all IntitialContext lookups are done 
through this class, to make it possible to get access to a JMS provider outside of 
JBoss.</para>
                                <para>The name is by default bound to the 
JbossMQProvider in jboss.jcml</para>
                                <programlisting><![CDATA[
  -  <mbean code="org.jboss.jms.jndi.JMSProviderLoader" 
name=":service=JMSProviderLoader,name=JBossMQProvider">
  -    <attribute name="ProviderName">DefaultJMSProvider</attribute>
  -    <attribute 
name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
  -  </mbean>
  +     <mbean code="org.jboss.jms.jndi.JMSProviderLoader" 
name=":service=JMSProviderLoader,name=JBossMQProvider">
  +       <attribute name="ProviderName">DefaultJMSProvider</attribute>
  +       <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider    
   </attribute>
  +     </mbean>
   ]]></programlisting>
                                <para>It is however possible to add more JMSProviders 
to the jboss.jcml and use them in the container configuration. On  possible reason to 
do this is if one want to listen to a queue or topic in another JBoss server. The one 
could define another provider and configure its context. Say we have a JBoss server on 
a machine remote.com. We might then ad this to jboss.jcml:</para>
                                <programlisting><![CDATA[
  -  <mbean code="org.jboss.jms.jndi.JMSProviderLoader" 
name=":service=JMSProviderLoader,name=RemoteJMSProvider">
  -    <attribute name="ProviderName">RemoteJMSProvider</attribute>
  -    <attribute 
name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
  -    <attribute name="ProviderUrl">remote.com:1099</attribute>
  -  </mbean>
  +     <mbean code="org.jboss.jms.jndi.JMSProviderLoader" 
name=":service=JMSProviderLoader,name=RemoteJMSProvider">
  +       <attribute name="ProviderName">RemoteJMSProvider</attribute>
  +       <attribute 
name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute>
  +       <attribute name="ProviderUrl">remote.com:1099</attribute>
  +     </mbean>
   ]]></programlisting>
                                <para>Note how we added a "ProviderUrl" attribute. In 
jboss.xml we would write this in the JMSProviderAdapterJNDI element:</para>
                                <programlisting><![CDATA[
  -<JMSProviderAdapterJNDI>RemoteJMSProvider</JMSProviderAdapterJNDI>
  +     <JMSProviderAdapterJNDI>RemoteJMSProvider</JMSProviderAdapterJNDI>
   ]]></programlisting>
                                <para>OBSERVE. I have this working for non transacted 
connections. It has not bean fully verified to work with the current 
JBossMQProvider.</para>
                                <para>Another way to use this configuration option is 
to integrate another JMS provider into JBoss. This was actually how MDB was first 
implemented in JBoss through the OpenJMS implementation. To do this one have to 
implement the interface org.jboss.jms.jndi.JMSProviderAdapter. Be aware though that if 
the JMS provider does not support the full JMS ASF (chapter 8 in the JMS spec) you 
will have to write a full implementation of both the ProvuderAdapter and the 
ServerSession stuff.</para>
                                <para>Next we have the "ServerSessionPoolFactoryJNDI" 
element</para>
                                <programlisting><![CDATA[
  -<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
  +     <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
   ]]></programlisting>
                                <para>This also points to a class loaded through 
jboss.jcml. It is the entry point to the ServerSessionPool. If one needs to write a 
provider specific pool or do some customization of the existing one, it would be 
possible to load that for a particular bean. The existing one is defined this way in 
jboss.jcml:</para>
                                <programlisting><![CDATA[
  -  <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader" 
name=":service=ServerSessionPoolMBean,name=StdJMSPool">
  -    <attribute name="PoolName">StdJMSPool</attribute>
  -    <attribute 
name="PoolFactoryClass">org.jboss.jms.asf.StdServerSessionPoolFactory</attribute>
  -  </mbean>
  +     <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader" 
name=":service=ServerSessionPoolMBean,name=StdJMSPool">
  +       <attribute name="PoolName">StdJMSPool</attribute>
  +       <attribute 
name="PoolFactoryClass">org.jboss.jms.asf.StdServerSessionPoolFactory</attribute>
  +     </mbean>
   ]]></programlisting>
                                <para>The first implementation of MDB for JBoss was 
based on another ServerSessionPoolFactory, specially written for OpenJMS. This is 
currently not verified to work. What do work is the pluggability of ServerSessionPool 
factories.</para>
                                <para>The last two entries looks like this:</para>
                                <programlisting><![CDATA[
  -  <MaximumSize>15</MaximumSize>
  -  <MaxMessages>1</MaxMessages>
  +     <MaximumSize>15</MaximumSize>
  +     <MaxMessages>1</MaxMessages>
   ]]></programlisting>
                                <para>The first of these - "MaximumSize" - defines how 
large the pool will be, i.e how many session it will have ready to serve incoming 
messages. The second one is used to configure the maximum number of messages a session 
is allowed to handle at once. I have never tweaked that one, and do not know if 
JBossMQ actually support that option. It might enhance performance if used.</para>
                        </section>
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to