Hi All,

Suran has got Apache Qpid working under JMS transport and had a few questions for me.
Instead of answering him individually I wrote up the following in case anybody else has questions.

I have tested the following with Axis2 1.4 release and should work well with the up comming Synapse release as well.

Documentation is broken into two sections.
It is important to read and understand the pros and cons for each option.

If you have any questions/suggestions please post on qpid-users@incubator.apache.org
And/Or open a JIRA at http://issues.apache.org/jira/browse/qpid
Your feedback is most welcomed.

1) Configuring the JMS transport using Apache Qpid M2.1 release.
   This version is the latest stable release and supports the 0-9 version of the AMQP protocol.
   You can download it from here http://cwiki.apache.org/qpid/download.html
   It is recomended that you use the Java broker.
   This is the recomended production version.

2) Configuring the JMS transport using Apache Qpid trunk. (with the usual caveat that it is a less stable and a moving target).
   The trunk supports the 0-10 version of the AMQP protocol.
   You can build it from source. https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid
   Next release is M3

   Has the following enchancements in the JMS client over M2.1
   -----------------------------------------------------------------------------------------
   1) You can specify multiple binding keys per destination.
      i.e you could bind a queue to a particular exchange using several binding keys there by allowing you to listen from multiple sources.
 
   2) You can bind your queue to any exchange type using the binding URL.

   3) You can set the following options per JMS connection.
      maxprefetch - The maximum number of pre-fetched messages per destination
      sync_persistence - When true, a sync command is sent after every persistent message to guarantee that it has been received by the broker.
     
   4) A new blocking transport (as an alternative to MINA) that gives much better latency, memory and increased throughput in many cases.


   Supported Broker
   -------------------------
   Currently only the c++ broker supports the 0-10 version.
   Supported platform is linux.

   In the pipeline
   --------------------
   Java Broker - expected to be in M3 release. Currently being refactored
   C++ broker - solaris and windows port are in progress (likely to be in M3 release)
        

1.0 Configuring the JMS transport using Apache Qpid M2.1 release
=============================================================

1.1 Qpid provides a convinient properties file based JNDI mechanism.
For provider URL please specify the location of the jndi.properties file.

<parameter name="myTopicConnectionFactory">
    <parameter name="java.naming.factory.initial">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
    <parameter name="java.naming.provider.url">file:///opt/workspace/sandbox/axis2-1.4</parameter>
    <parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
</parameter>

1.2 The following link provides documentation for the jndi.properties file.
http://cwiki.apache.org/qpid/how-to-use-jndi.html

The connection URL format is given here.
http://cwiki.apache.org/qpid/connection-url-format.html

1.3 The JMS transport allows you to specify a custom destination for your service via the "transport.jms.Destination" parameter.
If you do not specify this then the JMS transport will create a queue with the service name as its name.
In AMQP world the above translates to the following.
A queue will be created with service name as its name and will be bound to the amq.direct exchange with service name as the routing key.

If you specify a custom destination name via transport.jms.Destination in your services.xml then Qpid will look that up in the jndi.properties file and create queue based on the definition given in the file.
The binding URL format is given here.
http://cwiki.apache.org/qpid/bindingurlformat.html


2.0 Configuring the JMS transport using Apache Qpid trunk
======================================================
In addition to whats described above you can do the following.

2.1 Specifing multiple binding keys per destination
Ex
destination.wetherServiceQueue=topic://amq.topic/WeatherQueue?bindingkey='weather.us.*'&bindingkey='weather.ca.*'

The above will create a queue named WeatherQueue and will bind it to amq.topic with 'weather.us.*' and 'weather.ca.*' as the binding keys. The broker will then route any messages that matches the above patterns into WeatherQueue.

2.2 Binding your queue to any exchange type the broker supports
By using the binding URL you can bind your queue to any exchange type the broker supports.

For example if you want to bind your queue to a fanout exchange
destination.top10StockQueue=fanout://amq.fanout/WeatherQueue

2.3 Setting prefetch limit and sync_persistence per JMS connection
Ex.
amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672'&maxprefetch=2000&sync_persistence=true

2.4 Using the new transport
Set -Dtransport=io when starting Axis2 or Synapse.


Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/