Hi,
due to several recent questions regarding JMS, MDB on both dev and user
I tought I would sum up the status of JMS in JBoss and how "pluggable"
it is.

The JMS architecture of JBoss looks like this.

1. The JMS provider consists of JBossMQ. This is the part of JBoss that
   implements the JMS 1.0.2 (FULLY) specification. Everything that has
   to do with ordinary JMS (creating queues or topics, persistence and
   performace has to do with this part of JBoss).

   JBossMQ is its own CVS module and has its own mailinglist, where the
   core JBossMQ programmers hang out
   http://groups.yahoo.com/group/spyderMQ/.

   JBossMQ was created by  Norbert Lataille in the spring of 2000. Hiram
   Chirino sort of took over the resposibility in late 2000 and adedd
   (among other thing) asf and xa support. Paul Kendal has made some
   recent clean ups.

2. Message Driven Beans. Message Drivens Beans is part of the
   forthcomming EJB2.0 specification. It is part of the JBoss core EJB
   container system. As far as I know it is fully spec compliant (but
   remember, the spec is NOT finalized yet). I was the one who wrote it.

   It is not tightly bound to JBossMQ. But today JBossMQ is the only JMS
   provider it is known to work with. In the default configuration it
   therefore works with JBossMQ. 

3. JMS as a resource. In EJB2.0 and in J2EE 1.3 (if I remember the
   version correct) there is a requirement that it should be possible to
   use JMS as a container managed resource (much like a JDBC
   connection). In this scenario the transaction of a JMS session will
   be managed by the container and the session will be enrolled with any
   other transactional resource accessed from the same method.

   In JBoss 2.2.x there is NO support for this cind of JMS usage. In
   the developmen series a J2EE Connector architecture resource adapter
   for JMS has been added. This should be used for all non asynchrounous
   use of JMS from within EJB in JBoss. It is brifly described in  a
   change note:
   
http://sourceforge.net/tracker/index.php?func=detail&aid=419301&group_id=22866&atid=381174
   And there are examples in the jmsra part of the jbosstest module.

   This could be made completly generic, but is tied to the
   JMSProviderAdapter class in org.jboss.jms.jndi for now.


Is any of the JMS support in JBoss pluggable?

1. For ordinary JMS, here are a couple of possible ways to do it:

        a) Write a JMX bean that starts your alternative provider and that binds 
        the queues and topics and connection factories into the JBoss
        JNDI naming space.

        b) Start the server external to JBoss and create a way to look up that 
        servers JNDI somehow (which may be done by some JNDI magic - I
        don'r remember how, Scott knows, by manually feeding the needed
        stuff for JNDI when doing InitialContext or by writing your own
        JMSProviderAdapter class and use that.

2. MDB was first written to work with OpenJMS, since it was the only
   open source JMS provider with some basic asf support. This has
   however not been tested for a long, long time.

   In theory it should be possible to plugg in another JMS provider. The
   API to use is the following:

   If the provider implements JMS ASF in the way we have interpreted it
   (wich is today only documented in the code of org.jboss.jms.asf.*),
   the only thing one has to do is to write a new JMSProviderAdapter
   for the JMS provider and ad it to jboss.jcml. In the deployment
   descriptor of the message driven bean, one has to point the
   JMSProviderAdapterJNDI element to the JNDI name the new provider was
   bound to:
   <JMSProviderAdapterJNDI>AlternativeJMSProvider</JMSProviderAdapterJNDI>


    If the provider does not implement the ASF correctly (;-)), then the
    ServerSessionPool part is also configurable. A ServerSessionPool
    must follow the org.jboss.jms.asf.ServerSessionPoolFactory
    interface (and also ofcource the ServerSession and ServerSessionPool
    interface from the JMS spec). If it does that, a completly rewritten
    ServerSessionPool and ServerSession may be used, by binding the new
    ServerSessionPoolFactory to a JNDI name and use that in the
    deployment descriptor of the MDB.
    <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>

    I have to say that this would have to be seen as a fairly hard thing
    to do.

3. To get the new transacted behaviour for JMS one have to find a way to
   plug in the alternative JMS provider into the JMS RA. 

   Well, it's easy. Write an implementation of
   org.jboss.jms.jndi.JMSProviderAdapter and use the JMSProviderLoader
   to load it in jboss.jcml and bind it to some JNDI name.

   Then either reconfigure the JMS ra (ra.xml) to your new provider
    adapter:

            <config-property>
            <config-property-name>JmsProviderAdapterJNDI</config-property-name>
            <config-property-type>java.lang.String</config-property-type>
            <config-property-value>java:AlternativeJMSProvider</config-property-value>
        </config-property>

    Or create a new configuration in jboss.jcml, for example:

    <mbean code="org.jboss.resource.ConnectionFactoryLoader"
         name="JCA:service=ConnectionFactoryLoader,name=AltJmsXA">
    <attribute name="FactoryName">AltJmsXA</attribute>
    <attribute name="RARDeployerName">JCA:service=RARDeployer</attribute>
    <attribute name="ResourceAdapterName">JMS Adapter</attribute>
    <attribute name="ConnectionManagerFactoryName">MinervaXACMFactory</attribute>
    <attribute name="Properties">
      JmsProviderAdapterJNDI=java:AlternativeJMSProvider
    </attribute>

     <!-- See the documentation for the specific connection manager
         implementation you are using for the properties you can set -->
    <attribute name="ConnectionManagerProperties">
      # Pool type - uncomment to force, otherwise it is the default
      #PoolConfiguration=per-factory

      # Connection pooling properties - see
      # org.opentools.minerva.pool.PoolParameters
      MinSize=0
      MaxSize=10
      Blocking=true
      GCEnabled=false
      IdleTimeoutEnabled=false
      InvalidateOnError=false
      TrackLastUsed=false
      GCIntervalMillis=120000
      GCMinIdleMillis=1200000
      IdleTimeoutMillis=1800000
      MaxIdleTimeoutPercent=1.0
    </attribute>

    <!-- Principal mapping configuration -->
    <attribute 
name="PrincipalMappingClass">org.jboss.resource.security.ManyToOnePrincipalMapping</attribute>
    <attribute name="PrincipalMappingProperties">
    </attribute>
  </mbean>      

  And then configure your beans to use the JMS RA instead of the default
  (read the Change Note on how to do that; OK I know, I will document it
  some day).

Hope that shed some new light on the subject (and that you are able to
digest my broken english).

//Peter
On 23 Maj, Christian Riege wrote:
> hi everybody,
> 
> I need to access SonicMQ from my EJB's and I also need to use it for
> delivering messages to my Message Driven Beans (project w/ a client
> who is already using SonicMQ for his internal messaging).
> 
> Looking at the source of JBoss (CVS HEAD checkout) I *guess* that I
> have to write something along the lines of
> 
>     jboss/src/main/org/jboss/jms/jndi/JBossMQProvider.java
> 
> i.e. a SonicMQProvider.java where I access the JNDI provided from
> SonicMQ and then place this SonicMQProvider into jboss.jcml replacing
> the standard JBossMQProvider.
> 
> Is this the correct approach or am I missing something here?
> 
> Best regards,
>     Christian
> 

On 24 Maj, Breslauer, Don wrote:
> I'm new to JBoss, so I apologize in advance if has be covered already.
> 
> Is there any documentation available on how to deploy MDB beans on JBOSS,
> but using another JMS provider, such as fioranomq?  I imagine I would modify
> the JMS defalts in the jboss.jcml file?
> 
> thanks,
> Don
> 
-- 
------------------------------------------------------------
Peter Antman             Technology in Media, Box 34105 100 26 Stockholm
Systems Architect        WWW: http://www.tim.se
Email: [EMAIL PROTECTED]        WWW: http://www.backsource.org
Phone: +46-(0)8-506 381 11 Mobile: 070-675 3942 
------------------------------------------------------------


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

Reply via email to