You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2010/12/05 22:59:26 UTC

svn commit: r1042462 [11/12] - in /qpid/site/docs/books/0.8: ./ AMQP-Messaging-Broker-CPP-Book/ AMQP-Messaging-Broker-CPP-Book/html/ AMQP-Messaging-Broker-CPP-Book/html/images/ AMQP-Messaging-Broker-CPP-Book/html/images/jmx_console/ AMQP-Messaging-Brok...

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s13.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s13.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s13.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s13.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,22 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.13. Performance Tips</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch02.html" title="Chapter 2. Using the Qpid Messaging API"><link rel="prev" href="ch02s12.html" title="2.12. The Request / Response Pattern"><link rel="next" href="ch02s14.html" title="2.14. Cluster Failover"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.13. Performance Tips</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s12.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Using the Qpid Messaging API</th><td width="20%" align="right"> <a accesskey="n" href="ch02s14.html">Next</a></td></tr></table><hr></div><di
 v class="section" title="2.13. Performance Tips"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3083412"></a>2.13. Performance Tips</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Consider prefetching messages for receivers (see
+          <a class="xref" href="ch02s06.html" title="2.6. Receiver Capacity (Prefetch)">Section 2.6, &#8220;Receiver Capacity (Prefetch)&#8221;</a>). This helps eliminate roundtrips
+          and increases throughput. Prefetch is disabled by default,
+          and enabling it is the most effective means of improving
+          throughput of received messages.</p></li><li class="listitem"><p>Send messages asynchronously. Again, this helps
+          eliminate roundtrips and increases throughput. The C++ and
+          .NET clients send asynchronously by default, however the
+          python client defaults to synchronous sends.  </p></li><li class="listitem"><p>Acknowledge messages in batches (see
+          <a class="xref" href="ch02s07.html" title="2.7. Acknowledging Received Messages">Section 2.7, &#8220;Acknowledging Received Messages&#8221;</a>). Rather than
+          acknowledging each message individually, consider issuing
+          acknowledgements after n messages and/or after a particular
+          duration has elapsed.</p></li><li class="listitem"><p>Tune the sender capacity (see
+          <a class="xref" href="ch02s05.html" title="2.5. Sender Capacity and Replay">Section 2.5, &#8220;Sender Capacity and Replay&#8221;</a>). If the capacity is too low the
+          sender may block waiting for the broker to confirm receipt
+          of messages, before it can free up more capacity.</p></li><li class="listitem"><p>If you are setting a reply-to address on messages
+          being sent by the c++ client, make sure the address type is
+          set to either queue or topic as appropriate. This avoids the
+          client having to determine which type of node is being
+          refered to, which is required when hanling reply-to in AMQP
+          0-10. </p></li><li class="listitem"><p>For latency sensitive applications, setting tcp-nodelay
+	      on qpidd and on client connections can help reduce the
+	      latency.</p></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s12.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s14.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.12. The Request / Response Pattern </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.14. Cluster Failover</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s14.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s14.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s14.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s14.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,23 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.14. Cluster Failover</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch02.html" title="Chapter 2. Using the Qpid Messaging API"><link rel="prev" href="ch02s13.html" title="2.13. Performance Tips"><link rel="next" href="ch02s15.html" title="2.15. Logging"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.14. Cluster Failover</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s13.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Using the Qpid Messaging API</th><td width="20%" align="right"> <a accesskey="n" href="ch02s15.html">Next</a></td></tr></table><hr></div><div class="section" title
 ="2.14. Cluster Failover"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3083498"></a>2.14. Cluster Failover</h2></div></div></div><p>The messaging broker can be run in clustering mode, which provides high reliability through replicating state between brokers in the cluster. If one broker in a cluster fails, clients can choose another broker in the cluster and continue their work. Each broker in the cluster also advertises the addresses of all known brokers
+
+<sup>[<a name="id3083511" href="#ftn.id3083511" class="footnote">10</a>]</sup>
+
+. A client can use this information to dynamically keep the list of reconnection urls up to date.</p><p>In C++, the <code class="classname">FailoverUpdates</code> class provides this functionality:</p><div class="example"><a name="id3083526"></a><p class="title"><b>Example 2.19. Tracking cluster membership</b></p><div class="example-contents"><p>In C++:</p><pre class="programlisting">
+#include &lt;qpid/messaging/FailoverUpdates.h&gt;
+...
+Connection connection("localhost:5672");
+connection.setOption("reconnect", true);
+try {
+    connection.open();
+    std::auto_ptr&lt;FailoverUpdates&gt; updates(new FailoverUpdates(connection));
+
+	</pre><p>In python:</p><pre class="programlisting">
+import qpid.messaging.util
+...
+connection = Connection("localhost:5672")
+connection.reconnect = True
+try:
+  connection.open()
+  auto_fetch_reconnect_urls(connection)
+
+	</pre></div></div><br class="example-break"><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id3083511" href="#id3083511" class="para">10</a>] </sup>This is done via the amq.failover exchange in AMQP 0-10</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s13.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s15.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.13. Performance Tips </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.15. Logging</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s15.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s15.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s15.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s15.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,21 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.15. Logging</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch02.html" title="Chapter 2. Using the Qpid Messaging API"><link rel="prev" href="ch02s14.html" title="2.14. Cluster Failover"><link rel="next" href="ch02s16.html" title="2.16. The AMQP 0-10 mapping"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.15. Logging</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s14.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Using the Qpid Messaging API</th><td width="20%" align="right"> <a accesskey="n" href="ch02s16.html">Next</a></td></tr></table><hr></div><div class="section" title="2.
 15. Logging"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3083566"></a>2.15. Logging</h2></div></div></div><p>To simplify debugging, Qpid provides a logging facility
+      that prints out messaging events.</p><div class="section" title="2.15.1. Logging in C++"><div class="titlepage"><div><div><h3 class="title"><a name="id3083576"></a>2.15.1. Logging in C++</h3></div></div></div><p>The Qpidd broker and C++ clients can both use environment
+	variables to enable logging. Use QPID_LOG_ENABLE to set the
+	level of logging you are interested in (trace, debug, info,
+	notice, warning, error, or critical):</p><pre class="screen">
+$ export QPID_LOG_ENABLE="warning+"
+</pre><p>The Qpidd broker and C++ clients use QPID_LOG_OUTPUT to
+      determine where logging output should be sent. This is either a
+      file name or the special values stderr, stdout, or syslog:</p><pre class="screen">
+export QPID_LOG_TO_FILE="/tmp/myclient.out"
+</pre></div><div class="section" title="2.15.2. Logging in Python"><div class="titlepage"><div><div><h3 class="title"><a name="id3083607"></a>2.15.2. Logging in Python</h3></div></div></div><p>
+			The Python client library supports logging using the standard Python logging module. The easiest way to do logging is to use the <span class="command"><strong>basicConfig()</strong></span>, which reports all warnings and errors:
+		</p><pre class="programlisting">from logging import basicConfig
+basicConfig()
+</pre><p>
+			Qpidd also provides a convenience method that makes it easy to specify the level of logging desired. For instance, the following code enables logging at the <span class="command"><strong>DEBUG</strong></span> level:
+		</p><pre class="programlisting">from qpid.log import enable, DEBUG
+enable("qpid.messaging.io", DEBUG)
+</pre><p>
+			For more information on Python logging, see <a class="ulink" href="http://docs.python.org/lib/node425.html" target="_top">http://docs.python.org/lib/node425.html</a>. For more information on Qpid logging, use <span class="command"><strong>$ pydoc qpid.log</strong></span>.
+		</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s14.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s16.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.14. Cluster Failover </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.16. The AMQP 0-10 mapping</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s16.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s16.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s16.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch02s16.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,118 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.16. The AMQP 0-10 mapping</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch02.html" title="Chapter 2. Using the Qpid Messaging API"><link rel="prev" href="ch02s15.html" title="2.15. Logging"><link rel="next" href="ch03.html" title="Chapter 3. Using the Qpid JMS client"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.16. The AMQP 0-10 mapping</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s15.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Using the Qpid Messaging API</th><td width="20%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr></table><hr></div><div cl
 ass="section" title="2.16. The AMQP 0-10 mapping"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="section-amqp0-10-mapping"></a>2.16. The AMQP 0-10 mapping</h2></div></div></div><p>
+      This section describes the AMQP 0-10 mapping for the Qpid
+      Messaging API.
+    </p><p>
+        The interaction with the broker triggered by creating a sender
+        or receiver depends on what the specified address resolves
+        to. Where the node type is not specified in the address, the
+        client queries the broker to determine whether it refers to a
+        queue or an exchange.
+    </p><p>
+        When sending to a queue, the queue's name is set as the
+        routing key and the message is transfered to the default (or
+        nameless) exchange. When sending to an exchange, the message
+        is transfered to that exchange and the routing key is set to
+        the message subject if one is specified. A default subject may
+        be specified in the target address. The subject may also be
+        set on each message individually to override the default if
+        required. In each case any specified subject is also added as
+        a qpid.subject entry in the application-headers field of the
+        message-properties.
+      </p><p>
+        When receiving from a queue, any subject in the source address
+        is currently ignored. The client sends a message-subscribe
+        request for the queue in question. The accept-mode is
+        determined by the reliability option in the link properties;
+        for unreliable links the accept-mode is none, for reliable
+        links it is explicit. The default for a queue is reliable. The
+        acquire-mode is determined by the value of the mode option. If
+        the mode is set to browse the acquire mode is not-acquired,
+        otherwise it is set to pre-acquired. The exclusive and
+        arguments fields in the message-subscribe command can be
+        controlled using the x-subscribe map.
+      </p><p>
+        When receiving from an exchange, the client creates a
+        subscription queue and binds that to the exchange. The
+        subscription queue's arguments can be specified using the
+        x-declare map within the link properties. The reliability
+        option determines most of the other parameters. If the
+        reliability is set to unreliable then an auto-deleted,
+        exclusive queue is used meaning that if the client or
+        connection fails messages may be lost. For exactly-once the
+        queue is not set to be auto-deleted. The durability of the
+        subscription queue is determined by the durable option in the
+        link properties. The binding process depends on the type of
+        the exchange the source address resolves to.
+      </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+            For a topic exchange, if no subject is specified and no
+            x-bindings are defined for the link, the subscription
+            queue is bound using a wildcard matching any routing key
+            (thus satisfying the expectation that any message sent to
+            that address will be received from it). If a subject is
+            specified in the source address however, it is used for
+            the binding key (this means that the subject in the source
+            address may be a binding pattern including wildcards).
+          </p></li><li class="listitem"><p>
+            For a fanout exchange the binding key is irrelevant to
+            matching. A receiver created from a source address that
+            resolves to a fanout exchange receives all messages
+            sent to that exchange regardless of any subject the source
+            address may contain. An x-bindings element in the link
+            properties should be used if there is any need to set the
+            arguments to the bind.
+          </p></li><li class="listitem"><p>
+            For a direct exchange, the subject is used as the binding
+            key. If no subject is specified an empty string is used as
+            the binding key.
+          </p></li><li class="listitem"><p>
+            For a headers exchange, if no subject is specified the
+            binding arguments simply contain an x-match entry and no
+            other entries, causing all messages to match. If a subject
+            is specified then the binding arguments contain an x-match
+            entry set to all and an entry for qpid.subject whose value
+            is the subject in the source address (this means the
+            subject in the source address must match the message
+            subject exactly). For more control the x-bindings element
+            in the link properties must be used.
+          </p></li><li class="listitem"><p>
+            For the XML exchange,<sup>[<a name="id3083805" href="#ftn.id3083805" class="footnote">11</a>]</sup> if a subject is specified it is
+            used as the binding key and an XQuery is defined that
+            matches any message with that value for
+            qpid.subject. Again this means that only messages whose
+            subject exactly match that specified in the source address
+            are received. If no subject is specified then the empty
+            string is used as the binding key with an xquery that will
+            match any message (this means that only messages with an
+            empty string as the routing key will be received). For more
+            control the x-bindings element in the link properties must
+            be used. A source address that resolves to the XML
+            exchange must contain either a subject or an x-bindings
+            element in the link properties as there is no way at
+            present to receive any message regardless of routing key.
+          </p></li></ul></div><p>
+        If an x-bindings list is present in the link options a binding
+        is created for each element within that list. Each element is
+        a nested map that may contain values named queue, exchange,
+        key or arguments. If the queue value is absent the queue name
+        the address resolves to is implied. If the exchange value is
+        absent the exchange name the address resolves to is implied.
+      </p><p>The following table shows how Qpid Messaging API message
+        properties are mapped to AMQP 0-10 message properties and
+        delivery properties. In this table <code class="varname">msg</code>
+        refers to the Message class defined in the Qpid Messaging API,
+        <code class="varname">mp</code> refers to an AMQP 0-10
+        <code class="varname">message-properties</code> struct, and
+        <code class="varname">dp</code> refers to an AMQP 0-10
+        <code class="varname">delivery-properties</code> struct.</p><div class="table"><a name="table-amqp0-10-message-properties"></a><p class="title"><b>Table 2.8. Mapping to AMQP 0-10 Message Properties</b></p><div class="table-contents"><table summary="Mapping to AMQP 0-10 Message Properties" width="100%" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Python API</th><th>C++ API</th><th>AMQP 0-10 Property<sup>[<a name="id3083920" href="#ftn.id3083920" class="footnote">a</a>]</sup></th></tr></thead><tbody><tr><td>msg.id</td><td>msg.{get,set}MessageId()</td><td>mp.message_id</td></tr><tr><td>msg.subject</td><td>msg.{get,set}Subject()</td><td>mp.application_headers["qpid.subject"]</td></tr><tr><td>msg.user_id</td><td>msg.{get,set}UserId()</td><td>mp.user_id</td></tr><tr><td>msg.reply_to</td><td>msg.{get,set}ReplyTo()</td><td>mp.reply_to<sup>[<a name="id3083982" href="#ftn.id3083982" class="footnote">b</a>]</sup></td></tr><tr><td>msg.correlation_id</td><td>ms
 g.{get,set}CorrelationId()</td><td>mp.correlation_id</td></tr><tr><td>msg.durable</td><td>msg.{get,set}Durable()</td><td>dp.delivery_mode == delivery_mode.persistent<sup>[<a name="id3084008" href="#ftn.id3084008" class="footnote">c</a>]</sup></td></tr><tr><td>msg.priority</td><td>msg.{get,set}Priority()</td><td>dp.priority</td></tr><tr><td>msg.ttl</td><td>msg.{get,set}Ttl()</td><td>dp.ttl</td></tr><tr><td>msg.redelivered</td><td>msg.{get,set}Redelivered()</td><td>dp.redelivered</td></tr><tr><td>msg.properties</td><td>msg.{get,set}Properties()</td><td>mp.application_headers</td></tr><tr><td>msg.content_type</td><td>msg.{get,set}ContentType()</td><td>mp.content_type</td></tr></tbody><tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a name="ftn.id3083920" href="#id3083920" class="para">a</a>] </sup>In these entries, <code class="literal">mp</code> refers to an AMQP message property, and <code class="literal">dp</code> refers to an AMQP delivery proper
 ty.</p></div><div class="footnote"><p><sup>[<a name="ftn.id3083982" href="#id3083982" class="para">b</a>] </sup>The reply_to is converted from the protocol representation into an address.</p></div><div class="footnote"><p><sup>[<a name="ftn.id3084008" href="#id3084008" class="para">c</a>] </sup>Note that msg.durable is a boolean, not an enum.</p></div></td></tr></tbody></table></div></div><br class="table-break"><p>The 0-10 mapping also recognises certain special property
+      keys. If the properties contain entries for <code class="literal">x-amqp-0-10.app-id</code>
+      or <code class="literal">x-amqp-0-10.content-encoding</code>, the values will be used to
+      set <code class="literal">message-properties.app-id</code> and
+      <code class="literal">message-properties.content-encoding</code> on the
+      resulting 0-10 message transfer. Likewise if an incoming
+      transfer has those properties set, they will be exposed in the
+      same manner. In addition the routing key on incoming transfers
+      will be exposed directly via the custom property with key
+      <code class="literal">x-amqp-0-10.routing-key</code>.</p><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id3083805" href="#id3083805" class="para">11</a>] </sup>Note that the XML
+            exchange is not a standard AMQP exchange type. It is a
+            Qpid extension and is currently only supported by the C++
+            broker.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s15.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.15. Logging </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. Using the Qpid JMS client</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,78 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 3. Using the Qpid JMS client</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="index.html" title="Programming in Apache Qpid"><link rel="prev" href="ch02s16.html" title="2.16. The AMQP 0-10 mapping"><link rel="next" href="ch03s02.html" title="3.2. Apache Qpid JNDI Properties for AMQP Messaging"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Using the Qpid JMS client</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s16.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch03s02.html">Next</a></td></tr></table><hr></div><div c
 lass="chapter" title="Chapter 3. Using the Qpid JMS client"><div class="titlepage"><div><div><h2 class="title"><a name="QpidJMS"></a>Chapter 3. Using the Qpid JMS client</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch03.html#id3084118">3.1. A Simple Messaging Program in Java JMS</a></span></dt><dt><span class="section"><a href="ch03s02.html">3.2. Apache Qpid JNDI Properties for AMQP Messaging</a></span></dt><dd><dl><dt><span class="section"><a href="ch03s02.html#id3084697">3.2.1. JNDI Properties for Apache Qpid</a></span></dt><dt><span class="section"><a href="ch03s02.html#id3084806">3.2.2. Connection URLs</a></span></dt></dl></dd><dt><span class="section"><a href="ch03s03.html">3.3. Java JMS Message Properties</a></span></dt><dt><span class="section"><a href="ch03s04.html">3.4. JMS MapMessage Types</a></span></dt><dt><span class="section"><a href="ch03s05.html">3.5. JMS Client Logging</a></span></dt></dl></
 div><div class="section" title="3.1. A Simple Messaging Program in Java JMS"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3084118"></a>3.1. A Simple Messaging Program in Java JMS</h2></div></div></div><p>The following program shows how to send and receive a
+      message using the Qpid JMS client. JMS programs typically use
+      JNDI to obtain connection factory and destination objects which
+      the application needs. In this way the configuration is kept
+      separate from the application code itself.</p><p>In this example, we create a JNDI context using a
+      properties file, use the context to lookup a connection factory,
+      create and start a connection, create a session, and lookup a
+      destination from the JNDI context. Then we create a producer and
+      a consumer, send a message with the producer and receive it with
+      the consumer. This code should be straightforward for anyone
+      familiar with Java JMS.</p><div class="example"><a name="id3084143"></a><p class="title"><b>Example 3.1. "Hello world!" in Java</b></p><div class="example-contents"><pre lang="java" class="programlisting">
+package org.apache.qpid.example.jmsexample.hello;
+
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+public class Hello {
+
+  public Hello() {
+  }
+
+  public static void main(String[] args) {
+    Hello producer = new Hello();
+    producer.runTest();
+  }
+
+  private void runTest() {
+    try {
+      Properties properties = new Properties();
+      properties.load(this.getClass().getResourceAsStream("hello.properties"));  <a class="co" name="hello-java-properties" href="ch03.html#callout-java-properties">(1)</a>
+      Context context = new InitialContext(properties);   <a class="co" name="hello-java-context" href="ch03.html#callout-java-context">(2)</a>
+
+      ConnectionFactory connectionFactory 
+          = (ConnectionFactory) context.lookup("qpidConnectionfactory"); <a class="co" name="hello-java-connection-factory" href="ch03.html#callout-java-connection-factory">(3)</a>
+      Connection connection = connectionFactory.createConnection();  <a class="co" name="hello-java-connection" href="ch03.html#callout-java-connection">(4)</a>
+      connection.start();  <a class="co" name="hello-java-start" href="ch03.html#callout-java-start">(5)</a>
+
+      Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);<a class="co" name="hello-java-session" href="ch03.html#callout-java-session">(6)</a>
+      Destination destination = (Destination) context.lookup("topicExchange");  <a class="co" name="hello-java-destination" href="ch03.html#callout-java-destination">(7)</a>
+
+      MessageProducer messageProducer = session.createProducer(destination);  <a class="co" name="hello-java-producer" href="ch03.html#callout-java-producer">(8)</a>
+      MessageConsumer messageConsumer = session.createConsumer(destination);  <a class="co" name="hello-java-consumer" href="ch03.html#callout-java-consumer">(9)</a>
+
+      TextMessage message = session.createTextMessage("Hello world!");
+      messageProducer.send(message);
+
+      message = (TextMessage)messageConsumer.receive();    <a class="co" name="hello-java-receive" href="ch03.html#callout-java-receive">(10)</a>
+      System.out.println(message.getText());
+
+      connection.close();  <a class="co" name="hello-java-close" href="ch03.html#callout-java-close">(11)</a>
+      context.close();   <a class="co" name="hello-java-jndi-close" href="ch03.html#callout-java-jndi-close">(12)</a>
+    }
+    catch (Exception exp) {
+      exp.printStackTrace();
+    }
+  }
+}
+	</pre></div></div><br class="example-break"><div class="calloutlist"><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-properties"></a><a href="#hello-java-properties">(1)</a> </p></td><td valign="top" align="left"><p>Loads the JNDI properties file, which specifies connection properties, queues, topics, and addressing options. See <a class="xref" href="ch03s02.html" title="3.2. Apache Qpid JNDI Properties for AMQP Messaging">Section 3.2, &#8220;Apache Qpid JNDI Properties for AMQP Messaging&#8221;</a> for details.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-context"></a><a href="#hello-java-context">(2)</a> </p></td><td valign="top" align="left"><p>Creates the JNDI initial context.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-connection-factory"></a><a href="#hello-java-connection-factory">(3)</a> </p></td><td valign="top" align="left">
 <p>Creates a JMS connection factory for Qpid.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-connection"></a><a href="#hello-java-connection">(4)</a> </p></td><td valign="top" align="left"><p>Creates a JMS connection.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-start"></a><a href="#hello-java-start">(5)</a> </p></td><td valign="top" align="left"><p>Activates the connection.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-session"></a><a href="#hello-java-session">(6)</a> </p></td><td valign="top" align="left"><p>Creates a session. This session is not transactional (transactions='false'), and messages are automatically acknowledged.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-destination"></a><a href="#hello-java-destination">(7)</a> </p></td><td valign="top" align="left"><p>Creates a destination for the topic exchange, so sender
 s and receivers can use it.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-producer"></a><a href="#hello-java-producer">(8)</a> </p></td><td valign="top" align="left"><p>Creates a producer that sends messages to the topic exchange.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-consumer"></a><a href="#hello-java-consumer">(9)</a> </p></td><td valign="top" align="left"><p>Creates a consumer that reads messages from the topic exchange.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-receive"></a><a href="#hello-java-receive">(10)</a> </p></td><td valign="top" align="left"><p>Reads the next available message.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-close"></a><a href="#hello-java-close">(11)</a> </p></td><td valign="top" align="left"><p>Closes the connection, all sessions managed by the connection, and all senders and receivers ma
 naged by each session.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-java-jndi-close"></a><a href="#hello-java-jndi-close">(12)</a> </p></td><td valign="top" align="left"><p>Closes the JNDI context.</p></td></tr></table></div><p>The contents of the hello.properties file are shown below.</p><div class="example"><a name="id3084575"></a><p class="title"><b>Example 3.2. JNDI Properties File for "Hello world!" example</b></p><div class="example-contents"><pre class="programlisting">
+java.naming.factory.initial 
+  = org.apache.qpid.jndi.PropertiesFileInitialContextFactory
+
+# connectionfactory.[jndiname] = [ConnectionURL]
+connectionfactory.qpidConnectionfactory 
+  = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' <a class="co" name="hello-properties-connectionfactory" href="ch03.html#callout-hello-properties-connectionfactory">(1)</a>
+# destination.[jndiname] = [address_string]
+destination.topicExchange = amq.topic <a class="co" name="hello-properties-destination" href="ch03.html#callout-hello-properties-destination">(2)</a>
+     </pre></div></div><br class="example-break"><div class="calloutlist"><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><p><a name="callout-hello-properties-connectionfactory"></a><a href="#hello-properties-connectionfactory">(1)</a> </p></td><td valign="top" align="left"><p>Defines a connection factory from which connections
+	  can be created. The syntax of a ConnectionURL is given in
+	  <a class="xref" href="ch03s02.html" title="3.2. Apache Qpid JNDI Properties for AMQP Messaging">Section 3.2, &#8220;Apache Qpid JNDI Properties for AMQP Messaging&#8221;</a>.</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a name="callout-hello-properties-destination"></a><a href="#hello-properties-destination">(2)</a> </p></td><td valign="top" align="left"><p>Defines a destination for which MessageProducers
+	  and/or MessageConsumers can be created to send and receive
+	  messages. The value for the destination in the properties
+	  file is an address string as described in
+	  <a class="xref" href="ch02s04.html" title="2.4. Addresses">Section 2.4, &#8220;Addresses&#8221;</a>. In the JMS
+	  implementation MessageProducers are analogous to senders in
+	  the Qpid Message API, and MessageConsumers are analogous to
+	  receivers.</p></td></tr></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s16.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch03s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.16. The AMQP 0-10 mapping </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.2. Apache Qpid JNDI Properties for AMQP Messaging</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s02.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s02.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s02.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s02.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,212 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.2. Apache Qpid JNDI Properties for AMQP Messaging</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch03.html" title="Chapter 3. Using the Qpid JMS client"><link rel="prev" href="ch03.html" title="Chapter 3. Using the Qpid JMS client"><link rel="next" href="ch03s03.html" title="3.3. Java JMS Message Properties"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.2. Apache Qpid JNDI Properties for AMQP Messaging</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using the Qpid JMS client</th><td width="20%" align="right"> <a accesskey="n" hr
 ef="ch03s03.html">Next</a></td></tr></table><hr></div><div class="section" title="3.2. Apache Qpid JNDI Properties for AMQP Messaging"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="QpidJNDI"></a>3.2. Apache Qpid JNDI Properties for AMQP Messaging</h2></div></div></div><p>
+	Apache Qpid defines JNDI properties that can be used to specify JMS Connections and Destinations. Here is a typical JNDI properties file:
+      </p><div class="example"><a name="id3084675"></a><p class="title"><b>Example 3.3. JNDI Properties File</b></p><div class="example-contents"><pre class="programlisting">
+java.naming.factory.initial 
+  = org.apache.qpid.jndi.PropertiesFileInitialContextFactory
+
+# connectionfactory.[jndiname] = [ConnectionURL]
+connectionfactory.qpidConnectionfactory 
+  = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'
+# destination.[jndiname] = [address_string]
+destination.topicExchange = amq.topic
+</pre></div></div><br class="example-break"><p>The following sections describe the JNDI properties that Qpid uses.</p><div class="section" title="3.2.1. JNDI Properties for Apache Qpid"><div class="titlepage"><div><div><h3 class="title"><a name="id3084697"></a>3.2.1. JNDI Properties for Apache Qpid</h3></div></div></div><p>
+	  Apache Qpid supports the properties shown in the following table:
+        </p><div class="table"><a name="id3084707"></a><p class="title"><b>Table 3.1. JNDI Properties supported by Apache Qpid</b></p><div class="table-contents"><table summary="JNDI Properties supported by Apache Qpid" border="1"><colgroup><col><col></colgroup><thead><tr><th>
+		  Property
+	        </th><th>
+		  Purpose
+	        </th></tr></thead><tbody><tr><td>
+		  connectionfactory.&lt;jndiname&gt;
+	        </td><td>
+		  <p>
+		    The Connection URL that the connection factory uses to perform connections.
+		  </p>
+	        </td></tr><tr><td>
+		  queue.&lt;jndiname&gt;
+	        </td><td>
+		  <p>
+		    A JMS queue, which is implemented as an amq.direct exchange in Apache Qpid.
+		  </p>
+	        </td></tr><tr><td>
+		  topic.&lt;jndiname&gt;
+	        </td><td>
+		  <p>
+		    A JMS topic, which is implemented as an amq.topic exchange in Apache Qpid.
+		  </p>
+	        </td></tr><tr><td>
+		  destination.&lt;jndiname&gt;
+	        </td><td>
+		  <p>
+		    Can be used for defining all amq destinations,
+		    queues, topics and header matching, using an
+		    address string.  
+
+		    <sup>[<a name="id3084791" href="#ftn.id3084791" class="footnote">a</a>]</sup>
+		  </p>
+	        </td></tr></tbody><tbody class="footnotes"><tr><td colspan="2"><div class="footnote"><p><sup>[<a name="ftn.id3084791" href="#id3084791" class="para">a</a>] </sup>Binding URLs, which were used in
+		    earlier versions of the Qpid Java JMS client, can
+		    still be used instead of address
+		    strings.</p></div></td></tr></tbody></table></div></div><br class="table-break"></div><div class="section" title="3.2.2. Connection URLs"><div class="titlepage"><div><div><h3 class="title"><a name="id3084806"></a>3.2.2. Connection URLs</h3></div></div></div><p>
+	  In JNDI properties, a Connection URL specifies properties for a connection. The format for a Connection URL is:
+        </p><pre class="programlisting">amqp://[&lt;user&gt;:&lt;pass&gt;@][&lt;clientid&gt;]&lt;virtualhost&gt;[?&lt;option&gt;='&lt;value&gt;'[&amp;&lt;option&gt;='&lt;value&gt;']]
+        </pre><p>
+	  For instance, the following Connection URL specifies a user name, a password, a client ID, a virtual host ("test"), a broker list with a single broker, and a TCP host with the host name <span class="quote">&#8220;<span class="quote">localhost</span>&#8221;</span> using port 5672:
+        </p><pre class="programlisting">amqp://username:password@clientid/test?brokerlist='tcp://localhost:5672'
+        </pre><p>
+	  Apache Qpid supports the following properties in Connection URLs:
+        </p><div class="table"><a name="id3084847"></a><p class="title"><b>Table 3.2. Connection URL Properties</b></p><div class="table-contents"><table summary="Connection URL Properties" width="100%" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>
+		  Option
+	        </th><th>
+		  Type
+	        </th><th>
+		  Description
+	        </th></tr></thead><tbody><tr><td>
+		  brokerlist
+	        </td><td>
+		  see below
+	        </td><td>
+		  The broker to use for this connection. In the current release, precisely one broker must be specified.
+	        </td></tr><tr><td>
+		  maxprefetch
+	        </td><td>
+		  --
+	        </td><td>
+		  The maximum number of pre-fetched messages per destination.
+	        </td></tr><tr><td>
+		  sync_publish
+	        </td><td>
+           {'persistent' | 'all'}
+	        </td><td>
+          A sync command is sent after every persistent message to guarantee that it has been received; if the value is 'persistent', this is done only for persistent messages.
+	        </td></tr><tr><td>
+		  sync_ack
+	        </td><td>
+           Boolean
+	        </td><td>
+          A sync command is sent after every acknowledgement to guarantee that it has been received.
+	        </td></tr><tr><td>
+		  use_legacy_map_msg_format
+	        </td><td>
+          Boolean
+	        </td><td>
+          If you are using JMS Map messages and deploying a new client with any JMS client older than 0.8 release, you must set this to true to ensure the older clients can understand the map message encoding.
+	        </td></tr><tr><td>
+		  failover
+	        </td><td>
+           {'roundrobin' | 'failover_exchange'}
+	        </td><td>
+          If roundrobin is selected it will try each broker given in the broker list.
+          If failover_exchange is selected it connects to the initial broker given in the broker URL and will receive membership updates via the failover exchange.
+	        </td></tr></tbody></table></div></div><br class="table-break"><p>
+	  Broker lists are specified using a URL in this format:
+        </p><pre class="programlisting">brokerlist=&lt;transport&gt;://&lt;host&gt;[:&lt;port&gt;](?&lt;param&gt;=&lt;value&gt;)?(&amp;&lt;param&gt;=&lt;value&gt;)*</pre><p>
+	  For instance, this is a typical broker list:
+        </p><pre class="programlisting">brokerlist='tcp://localhost:5672'
+        </pre><p>
+	  A broker list can contain more than one broker address; if so, the connection is made to the first broker in the list that is available. In general, it is better to use the failover exchange when using multiple brokers, since it allows applications to fail over if a broker goes down.
+	</p><div class="example"><a name="id3085009"></a><p class="title"><b>Example 3.4. Broker Lists</b></p><div class="example-contents"><p>A broker list can specify properties to be used when connecting to the broker, such as security options. This broker list specifies options for a Kerberos connection using GSSAPI:</p><pre class="programlisting">
+amqp://guest:guest@test/test?sync_ack='true'
+    &amp;brokerlist='tcp://ip1:5672?sasl_mechs='GSSAPI'
+	</pre><p>This broker list specifies SSL options:</p><pre class="programlisting">
+amqp://guest:guest@test/test?sync_ack='true'
+   &amp;brokerlist='tcp://ip1:5672?ssl='true'&amp;ssl_cert_alias='cert1'
+	</pre></div></div><br class="example-break"><p>The following broker list options are supported.</p><div class="table"><a name="id3085044"></a><p class="title"><b>Table 3.3. Broker List Options</b></p><div class="table-contents"><table summary="Broker List Options" width="100%" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>
+		  Option
+	        </th><th>
+		  Type
+	        </th><th>
+		  Description
+	        </th></tr></thead><tbody><tr><td>
+		  heartbeat
+	        </td><td>
+		  integer
+	        </td><td>
+		  frequency of heartbeat messages (in seconds)
+	        </td></tr><tr><td>
+		  sasl_mechs
+	        </td><td>
+		  --
+	        </td><td>
+		  For secure applications, we suggest CRAM-MD5,
+		  DIGEST-MD5, or GSSAPI. The ANONYMOUS method is not
+		  secure. The PLAIN method is secure only when used
+		  together with SSL. For Kerberos, sasl_mechs must be
+		  set to GSSAPI, sasl_protocol must be set to the
+		  principal for the qpidd broker, e.g. qpidd/, and
+		  sasl_server must be set to the host for the SASL
+		  server, e.g. sasl.com.  SASL External is supported
+		  using SSL certification, e.g.
+		  <code class="literal">ssl='true'&amp;sasl_mechs='EXTERNAL'</code>
+	        </td></tr><tr><td>
+		  sasl_encryption
+	        </td><td>
+          Boolean  
+	        </td><td>
+          If <code class="literal">sasl_encryption='true'</code>, the JMS client attempts to negotiate a security layer with the broker using GSSAPI to encrypt the connection. Note that for this to happen, GSSAPI must be selected as the sasl_mech.
+	        </td></tr><tr><td>
+		  ssl
+	        </td><td>
+		  Boolean
+	        </td><td>
+		  If <code class="literal">ssl='true'</code>, the JMS client will encrypt the connection using SSL.
+	        </td></tr><tr><td>
+		  tcp_nodelay
+	        </td><td>
+		  Boolean
+	        </td><td>
+		  If <code class="literal">tcp_nodelay='true'</code>, TCP packet
+		  batching is disabled.
+	        </td></tr><tr><td>
+		  sasl_protocol
+	        </td><td>
+		  --
+	        </td><td>
+		  Used only for
+		  Kerberos. <code class="literal">sasl_protocol</code> must be
+		  set to the principal for the qpidd broker,
+		  e.g. <code class="literal">qpidd/</code>
+	        </td></tr><tr><td>
+		  sasl_server
+	        </td><td>
+		  --
+	        </td><td>
+		  For Kerberos, sasl_mechs must be set to GSSAPI,
+		  sasl_server must be set to the host for the SASL
+		  server, e.g. <code class="literal">sasl.com</code>.
+	        </td></tr><tr><td>
+		  trust_store
+	        </td><td>
+		  --
+	        </td><td>
+		  path to Keberos trust store
+	        </td></tr><tr><td>
+		  trust_store_password
+	        </td><td>
+	        </td><td>
+		  Kerberos trust store password
+	        </td></tr><tr><td>
+		  key_store
+	        </td><td>
+	        </td><td>
+		  path to Kerberos key store
+	        </td></tr><tr><td>
+		  key_store_password
+	        </td><td>
+		  --
+	        </td><td>
+		  Kerberos key store password
+	        </td></tr><tr><td>
+		  ssl_verify_hostname
+	        </td><td>
+		  Boolean
+	        </td><td>
+		  When using SSL you can enable hostname verification
+		  by using "ssl_verify_hostname=true" in the broker
+		  URL.
+	        </td></tr><tr><td>
+		  ssl_cert_alias
+	        </td><td>
+
+	        </td><td>
+          If multiple certificates are present in the keystore, the alias will be used to extract the correct certificate.
+	        </td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Using the Qpid JMS client </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.3. Java JMS Message Properties</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s03.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s03.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s03.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s03.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,8 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.3. Java JMS Message Properties</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch03.html" title="Chapter 3. Using the Qpid JMS client"><link rel="prev" href="ch03s02.html" title="3.2. Apache Qpid JNDI Properties for AMQP Messaging"><link rel="next" href="ch03s04.html" title="3.4. JMS MapMessage Types"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.3. Java JMS Message Properties</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using the Qpid JMS client</th><td width="20%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a
 ></td></tr></table><hr></div><div class="section" title="3.3. Java JMS Message Properties"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3085314"></a>3.3. Java JMS Message Properties</h2></div></div></div><p>The following table shows how Qpid Messaging API message
+        properties are mapped to AMQP 0-10 message properties and
+        delivery properties. In this table <code class="varname">msg</code>
+        refers to the Message class defined in the Qpid Messaging API,
+        <code class="varname">mp</code> refers to an AMQP 0-10
+        <code class="varname">message-properties</code> struct, and
+        <code class="varname">dp</code> refers to an AMQP 0-10
+        <code class="varname">delivery-properties</code> struct.</p><div class="table"><a name="id3085345"></a><p class="title"><b>Table 3.4. Java JMS Mapping to AMQP 0-10 Message Properties</b></p><div class="table-contents"><table summary="Java JMS Mapping to AMQP 0-10 Message Properties" border="1"><colgroup><col><col></colgroup><thead><tr><th>Java JMS Message Property</th><th>AMQP 0-10 Property<sup>[<a name="id3085365" href="#ftn.id3085365" class="footnote">a</a>]</sup></th></tr></thead><tbody><tr><td>JMSMessageID</td><td>mp.message_id</td></tr><tr><td>qpid.subject<sup>[<a name="id3085398" href="#ftn.id3085398" class="footnote">b</a>]</sup></td><td>mp.application_headers["qpid.subject"]</td></tr><tr><td>JMSXUserID</td><td>mp.user_id</td></tr><tr><td>JMSReplyTo</td><td>mp.reply_to<sup>[<a name="id3085423" href="#ftn.id3085423" class="footnote">c</a>]</sup></td></tr><tr><td>JMSCorrelationID</td><td>mp.correlation_id</td></tr><tr><td>JMSDeliveryMode</td><td>dp.delivery_mo
 de</td></tr><tr><td>JMSPriority</td><td>dp.priority</td></tr><tr><td>JMSExpiration</td><td>dp.ttl<sup>[<a name="id3085462" href="#ftn.id3085462" class="footnote">d</a>]</sup></td></tr><tr><td>JMSRedelivered</td><td>dp.redelivered</td></tr><tr><td>JMS Properties</td><td>mp.application_headers</td></tr><tr><td>JMSType</td><td>mp.content_type</td></tr></tbody><tbody class="footnotes"><tr><td colspan="2"><div class="footnote"><p><sup>[<a name="ftn.id3085365" href="#id3085365" class="para">a</a>] </sup>In these entries, <code class="literal">mp</code> refers to an AMQP message property, and <code class="literal">dp</code> refers to an AMQP delivery property.</p></div><div class="footnote"><p><sup>[<a name="ftn.id3085398" href="#id3085398" class="para">b</a>] </sup>This is a custom JMS property, set automatically by the Java JMS client implementation.</p></div><div class="footnote"><p><sup>[<a name="ftn.id3085423" href="#id3085423" class="para">c</a>] </sup>The reply_to is convert
 ed from the protocol representation into an address.</p></div><div class="footnote"><p><sup>[<a name="ftn.id3085462" href="#id3085462" class="para">d</a>] </sup>JMSExpiration = dp.ttl + currentTime</p></div></td></tr></tbody></table></div></div><br class="table-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.2. Apache Qpid JNDI Properties for AMQP Messaging </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.4. JMS MapMessage Types</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s04.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s04.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s04.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s04.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,51 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.4. JMS MapMessage Types</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch03.html" title="Chapter 3. Using the Qpid JMS client"><link rel="prev" href="ch03s03.html" title="3.3. Java JMS Message Properties"><link rel="next" href="ch03s05.html" title="3.5. JMS Client Logging"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.4. JMS MapMessage Types</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using the Qpid JMS client</th><td width="20%" align="right"> <a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div c
 lass="section" title="3.4. JMS MapMessage Types"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="section-JMS-MapMessage"></a>3.4. JMS MapMessage Types</h2></div></div></div><p>Qpid supports the Java JMS <code class="classname">MapMessage</code> interface, which provides support for maps in messages. The following code shows how to send a <code class="classname">MapMessage</code> in Java JMS.</p><div class="example"><a name="id3085516"></a><p class="title"><b>Example 3.5. Sending a Java JMS MapMessage</b></p><div class="example-contents"><pre class="programlisting">
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.MapMessage;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+
+import edu.emory.mathcs.backport.java.util.Arrays;
+
+// !!! SNIP !!!
+
+MessageProducer producer = session.createProducer(queue);
+
+MapMessage m = session.createMapMessage();
+m.setIntProperty("Id", 987654321);
+m.setStringProperty("name", "Widget");
+m.setDoubleProperty("price", 0.99);
+
+List&lt;String&gt; colors = new ArrayList&lt;String&gt;();
+colors.add("red");
+colors.add("green");
+colors.add("white");        
+m.setObject("colours", colors);
+
+Map&lt;String,Double&gt; dimensions = new HashMap&lt;String,Double&gt;();
+dimensions.put("length",10.2);
+dimensions.put("width",5.1);
+dimensions.put("depth",2.0);
+m.setObject("dimensions",dimensions);
+
+List&lt;List&lt;Integer&gt;&gt; parts = new ArrayList&lt;List&lt;Integer&gt;&gt;();
+parts.add(Arrays.asList(new Integer[] {1,2,5}));
+parts.add(Arrays.asList(new Integer[] {8,2,5}));
+m.setObject("parts", parts);
+
+Map&lt;String,Object&gt; specs = new HashMap&lt;String,Object&gt;();
+specs.put("colours", colors);
+specs.put("dimensions", dimensions);
+specs.put("parts", parts);
+m.setObject("specs",specs);
+
+producer.send(m);
+      </pre></div></div><br class="example-break"><p>The following table shows the datatypes that can be sent in a <code class="classname">MapMessage</code>, and the corresponding datatypes that will be received by clients in Python or C++.</p><div class="table"><a name="table-Java-Maps"></a><p class="title"><b>Table 3.5. Java Datatypes in Maps</b></p><div class="table-contents"><table summary="Java Datatypes in Maps" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Java Datatype</th><th>&#8594; Python</th><th>&#8594; C++</th></tr></thead><tbody><tr><td>boolean</td><td>bool</td><td>bool</td></tr><tr><td>short</td><td>int | long</td><td>int16</td></tr><tr><td>int</td><td>int | long</td><td>int32</td></tr><tr><td>long</td><td>int | long</td><td>int64</td></tr><tr><td>float</td><td>float</td><td>float</td></tr><tr><td>double</td><td>float</td><td>double</td></tr><tr><td>java.lang.String</td><td>unicode</td><td>std::string</td></tr><tr><td>java.util.UUID</td><td>u
 uid</td><td>qpid::types::Uuid</td></tr><tr><td>java.util.Map<sup>[<a name="id3085663" href="#ftn.id3085663" class="footnote">a</a>]</sup></td><td>dict</td><td>Variant::Map</td></tr><tr><td>java.util.List</td><td>list</td><td>Variant::List</td></tr></tbody><tbody class="footnotes"><tr><td colspan="3"><div class="footnote"><p><sup>[<a name="ftn.id3085663" href="#id3085663" class="para">a</a>] </sup>In Qpid, maps can nest. This goes beyond the functionality required by the JMS specification.</p></div></td></tr></tbody></table></div></div><br class="table-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.3. Java JMS Message Properties </td><td width
 ="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.5. JMS Client Logging</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s05.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s05.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s05.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch03s05.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,9 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3.5. JMS Client Logging</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch03.html" title="Chapter 3. Using the Qpid JMS client"><link rel="prev" href="ch03s04.html" title="3.4. JMS MapMessage Types"><link rel="next" href="ch04.html" title="Chapter 4. Using the Qpid WCF client"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.5. JMS Client Logging</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using the Qpid JMS client</th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div clas
 s="section" title="3.5. JMS Client Logging"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="section-JMS-Logging"></a>3.5. JMS Client Logging</h2></div></div></div><p>The JMS Client logging is handled using the Simple Logging Facade for Java (<a class="ulink" href="http://www.slf4j.org/" target="_top">SLF4J</a>). As the name implies, slf4j is a facade that delegates to other logging systems like log4j or JDK 1.4 logging. For more information on how to configure slf4j for specific logging systems, please consult the slf4j documentation.</p><p>When using the log4j binding, please set the log level for org.apache.qpid explicitly. Otherwise log4j will default to DEBUG which will degrade performance considerably due to excessive logging. The recommended logging level for production is <code class="literal">WARN</code>.</p><p>The following example shows the logging properties used to configure client logging for slf4j using the log4j binding. These
  properties can be placed in a log4j.properties file and placed in the <code class="varname">CLASSPATH</code>, or they can be set explicitly using the <code class="literal">-Dlog4j.configuration</code> property.</p><div class="example"><a name="id3085736"></a><p class="title"><b>Example 3.6. log4j Logging Properties</b></p><div class="example-contents"><pre class="programlisting">
+log4j.logger.org.apache.qpid=WARN, console
+log4j.additivity.org.apache.qpid=false
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Threshold=all
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n
+</pre></div></div><br class="example-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.4. JMS MapMessage Types </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Using the Qpid WCF client</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,226 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 4. Using the Qpid WCF client</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="index.html" title="Programming in Apache Qpid"><link rel="prev" href="ch03s05.html" title="3.5. JMS Client Logging"><link rel="next" href="ch04s02.html" title="4.2. Endpoints"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Using the Qpid WCF client</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 4. Using 
 the Qpid WCF client"><div class="titlepage"><div><div><h2 class="title"><a name="QpidWCF"></a>Chapter 4. Using the Qpid WCF client</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch04.html#id3085763">4.1. XML and Binary Bindings</a></span></dt><dt><span class="section"><a href="ch04s02.html">4.2. Endpoints</a></span></dt><dt><span class="section"><a href="ch04s03.html">4.3. Message Headers</a></span></dt><dt><span class="section"><a href="ch04s04.html">4.4. Security</a></span></dt><dt><span class="section"><a href="ch04s05.html">4.5. Transactions</a></span></dt></dl></div><div class="section" title="4.1. XML and Binary Bindings"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3085763"></a>4.1. XML and Binary Bindings</h2></div></div></div><p>The Qpid WCF client provides two bindings, each with support for
+      Windows .NET transactions.</p><p>The AmqpBinding is suitable for communication between two WCF
+      applications.  By default it uses the WCF binary .NET XML encoder
+      (BinaryMessageEncodingBindingElement) for efficient message
+      transmission, but it can also use the text and Message Transmission
+      Optimization Mechanism (MTOM) encoders.  Here is a traditional service
+      model sample program using the AmqpBinding.  It assumes that the queue
+      "hello_service_node" has been created and configured on the AMQP
+      broker.</p><div class="example"><a name="id3085785"></a><p class="title"><b>Example 4.1. Traditional service model "Hello world!" example</b></p><div class="example-contents"><pre class="programlisting">
+namespace Apache.Qpid.Documentation.HelloService
+{
+  using System;
+  using System.ServiceModel;
+  using System.ServiceModel.Channels;
+  using System.Threading;
+  using Apache.Qpid.Channel;
+
+  [ServiceContract]
+  public interface IHelloService
+  {
+    [OperationContract(IsOneWay = true, Action = "*")]
+    void SayHello(string greeting);
+  }
+
+  public class HelloService : IHelloService
+  {
+    private static int greetingCount;
+
+    public static int GreetingCount
+    {
+      get { return greetingCount; }
+    }
+
+    public void SayHello(string greeting)
+    {
+      Console.WriteLine("Service received: " + greeting);
+      greetingCount++;
+    }</pre><pre class="programlisting">
+    static void Main(string[] args)
+    {
+      try
+      {
+        AmqpBinding amqpBinding = new AmqpBinding();
+        amqpBinding.BrokerHost = "localhost";
+        amqpBinding.BrokerPort = 5672;
+
+        ServiceHost serviceHost = new ServiceHost(typeof(HelloService));
+        serviceHost.AddServiceEndpoint(typeof(IHelloService),
+          amqpBinding, "amqp:hello_service_node");
+        serviceHost.Open();
+
+        // Send the service a test greeting
+        Uri amqpClientUri=new Uri("amqp:amq.direct?routingkey=hello_service_node");
+        EndpointAddress clientEndpoint = new EndpointAddress(amqpClientUri);
+        ChannelFactory&lt;IHelloService&gt; channelFactory =
+          new ChannelFactory&lt;IHelloService&gt;(amqpBinding, clientEndpoint);
+        IHelloService clientProxy = channelFactory.CreateChannel();
+
+        clientProxy.SayHello("Greetings from WCF client");
+
+        // wait for service to process the greeting
+        while (HelloService.GreetingCount == 0)
+        {
+          Thread.Sleep(100);
+        }
+        channelFactory.Close();
+        serviceHost.Close();
+      }
+      catch (Exception e)
+      {
+        Console.WriteLine("Exception: {0}", e);
+      }
+    }
+  }
+}
+      </pre></div></div><br class="example-break"><p>The second binding, AmqpBinaryBinding, is suitable for WCF
+      applications that need to inter-operate with non-WCF clients or that
+      wish to have direct access to the raw wire representation of the
+      message body.  It relies on a custom encoder to read and write raw
+      (binary) content which operates similarly to the ByteStream encoder
+      (introduced in .NET 4.0).  The encoder presents an abstract XML
+      infoset view of the raw message content on input.  On output, the
+      encoder does the reverse and peels away the XML infoset layer exposing
+      the raw content to the wire representation of the message body.  The
+      application must do the inverse of what the encoder does to allow the
+      XML infoset wrapper to cancel properly.  This is demonstrated in the
+      following sample code (using the channel programming model) which
+      directly manipulates or provides callbacks to the WCF message readers
+      and writers when the content is consumed.  In contrast to the
+      AmqpBinding sample where the simple greeting is encapsulated in a
+      compressed SOAP envelope, the wire representation of the message
+      contains the raw content and is identical and fully interoperable with
+      the Qpid C++ "Hello world!"  example.</p><div class="example"><a name="id3085805"></a><p class="title"><b>Example 4.2. Binary  "Hello world!" example using the channel model</b></p><div class="example-contents"><pre class="programlisting">
+namespace Apache.Qpid.Samples.Channel.HelloWorld
+{
+  using System;
+  using System.ServiceModel;
+  using System.ServiceModel.Channels;
+  using System.ServiceModel.Description;
+  using System.Text;
+  using System.Xml;
+  using Apache.Qpid.Channel;
+
+  public class HelloWorld
+  {  
+    static void Main(string[] args)
+    {
+      String broker = "localhost";
+      int port = 5672;
+      String target = "amq.topic";
+      String source = "my_topic_node";
+
+      if (args.Length &gt; 0)
+      {
+        broker = args[0];
+      }
+
+      if (args.Length &gt; 1)
+      {
+        port = int.Parse(args[1]);
+      }
+
+      if (args.Length &gt; 2)
+      {
+        target = args[2];
+      }
+
+      if (args.Length &gt; 3)
+      {
+        source = args[3];
+      }
+
+      AmqpBinaryBinding binding = new AmqpBinaryBinding();
+      binding.BrokerHost = broker;
+      binding.BrokerPort = port;
+
+      IChannelFactory&lt;IInputChannel&gt; receiverFactory = binding.BuildChannelFactory&lt;IInputChannel&gt;();
+      receiverFactory.Open();
+      IInputChannel receiver = receiverFactory.CreateChannel(new EndpointAddress("amqp:" + source));
+      receiver.Open();
+
+      IChannelFactory&lt;IOutputChannel&gt; senderFactory = binding.BuildChannelFactory&lt;IOutputChannel&gt;();
+      senderFactory.Open();
+      IOutputChannel sender = senderFactory.CreateChannel(new EndpointAddress("amqp:" + target));
+      sender.Open();
+
+      sender.Send(Message.CreateMessage(MessageVersion.None, "", new HelloWorldBinaryBodyWriter()));
+
+      Message message = receiver.Receive();
+      XmlDictionaryReader reader = message.GetReaderAtBodyContents();
+      while (!reader.HasValue)
+      {
+        reader.Read();
+      }
+
+      byte[] binaryContent = reader.ReadContentAsBase64();
+      string text = Encoding.UTF8.GetString(binaryContent);
+
+      Console.WriteLine(text);
+
+      senderFactory.Close();
+      receiverFactory.Close();
+    }
+  }
+
+  public class HelloWorldBinaryBodyWriter : BodyWriter
+  {
+    public HelloWorldBinaryBodyWriter() : base (true) {}
+
+    protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
+    {
+      byte[] binaryContent = Encoding.UTF8.GetBytes("Hello world!");
+
+      // wrap the content:
+      writer.WriteStartElement("Binary");
+      writer.WriteBase64(binaryContent, 0, binaryContent.Length);
+    }
+  }
+}
+</pre></div></div><br class="example-break"><p>Bindings define ChannelFactories and ChannelListeners associated with
+      an AMQP Broker.  WCF will frequently automatically create and manage
+      the life cycle of a these and the resulting IChannel objects used in
+      message transfer.  The binding parameters that can be set are:</p><div class="table"><a name="id3085879"></a><p class="title"><b>Table 4.1. WCF Binding Parameters</b></p><div class="table-contents"><table summary="WCF Binding Parameters" width="100%" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>
+		BrokerHost
+	      </td><td>
+		localhost
+	      </td><td>
+		The broker's server name.  Currently the WCF channel
+		only supports connections with a single broker.
+		Failover to multiple brokers will be provided in the
+		future.
+	      </td></tr><tr><td>
+		BrokerPort
+	      </td><td>
+		5672
+	      </td><td>
+		The port the broker is listening on.
+	      </td></tr><tr><td>
+		PrefetchLimit
+	      </td><td>
+		0
+	      </td><td>
+		The number of messages to prefetch from the amqp
+		broker before the application actually consumes them.
+		Increasing this number can dramatically increase the
+		read performance in some circumstances.
+	      </td></tr><tr><td>
+		Shared
+	      </td><td>
+		false
+	      </td><td>
+		Indicates if separate channels to the same broker can
+		share an underlying AMQP tcp connection (provided they
+		also share the same authentication credentials).
+	      </td></tr><tr><td>
+		TransferMode
+	      </td><td>
+		buffered
+	      </td><td>
+		Indicates whether the channel's encoder uses the WCF
+		BufferManager cache to temporarily store message
+		content during the encoding/decoding phase.  For small
+		to medium sized SOAP based messages, buffered is
+		usually the preferred choice.  For binary messages,
+		streamed TransferMode is the more efficient mode.
+	      </td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch04s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.5. JMS Client Logging </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.2. Endpoints</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s02.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s02.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s02.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s02.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,11 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.2. Endpoints</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch04.html" title="Chapter 4. Using the Qpid WCF client"><link rel="prev" href="ch04.html" title="Chapter 4. Using the Qpid WCF client"><link rel="next" href="ch04s03.html" title="4.3. Message Headers"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.2. Endpoints</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Using the Qpid WCF client</th><td width="20%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr></table><hr></div><div class="section" title="4.2.
  Endpoints"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3086052"></a>4.2. Endpoints</h2></div></div></div><p>In Qpid 0.6 the WCF Endpoints map to simple AMQP 0-10
+      exchanges (IOutputChannel) or AMQP 0-10 queues (IInputChannel).
+      The format for an IOutputChannel is</p><pre class="programlisting">
+  "amqp:amq.direct" or "amqp:my_exchange?routingkey=my_routing_key"
+</pre><p>and for an IInputChannel is</p><pre class="programlisting">
+  "amqp:my_queue"
+</pre><p>The routing key is in fact a default value associated with
+      the particular channel.  Outgoing messages can always have their
+      routing key uniquely set.</p><p>If the respective queue or exchange doesn't exist, an exception
+      is thrown when opening the channel.  Queues and exchanges can be
+      created and configured using qpid-config.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Using the Qpid WCF client </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.3. Message Headers</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s03.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s03.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s03.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s03.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,19 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.3. Message Headers</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch04.html" title="Chapter 4. Using the Qpid WCF client"><link rel="prev" href="ch04s02.html" title="4.2. Endpoints"><link rel="next" href="ch04s04.html" title="4.4. Security"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.3. Message Headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Using the Qpid WCF client</th><td width="20%" align="right"> <a accesskey="n" href="ch04s04.html">Next</a></td></tr></table><hr></div><div class="section" title="4.3. Message He
 aders"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3086093"></a>4.3. Message Headers</h2></div></div></div><p>AMQP specific message headers can be set on or retrieved
+      from the ServiceModel.Channels.Message using the AmqpProperties
+      type.</p><p>For example, on output:</p><pre class="programlisting">
+AmqpProperties props = new AmqpProperties();
+props.Durable = true;
+props.PropertyMap.Add("my_custom_header", new AmqpString("a custom value"));
+Message msg = Message.CreateMessage(args);
+msg.Properties.Add("AmqpProperties", amqpProperties);
+outputChannel.Send(msg);
+</pre><p>On input the headers can be accessed from the Message or extracted
+      from the operation context</p><pre class="programlisting">
+public void SayHello(string greeting)
+{
+  AmqpProperties props = (AmqpProperties) OperationContext.
+  Current.IncomingMessageProperties["AmqpProperties"];
+  AmqpString extra = (AmqpString) props.PropertyMap["my_custom_header"];
+  Console.WriteLine("Service received: {0} and {1}", greeting, extra);
+}
+</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.2. Endpoints </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.4. Security</td></tr></table></div></body></html>

Added: qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s04.html
URL: http://svn.apache.org/viewvc/qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s04.html?rev=1042462&view=auto
==============================================================================
--- qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s04.html (added)
+++ qpid/site/docs/books/0.8/Programming-In-Apache-Qpid/html/ch04s04.html Sun Dec  5 21:59:22 2010
@@ -0,0 +1,21 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.4. Security</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Programming in Apache Qpid"><link rel="up" href="ch04.html" title="Chapter 4. Using the Qpid WCF client"><link rel="prev" href="ch04s03.html" title="4.3. Message Headers"><link rel="next" href="ch04s05.html" title="4.5. Transactions"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.4. Security</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Using the Qpid WCF client</th><td width="20%" align="right"> <a accesskey="n" href="ch04s05.html">Next</a></td></tr></table><hr></div><div class="section" title="4.4. Security"><div
  class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id3086128"></a>4.4. Security</h2></div></div></div><p>To engage TLS/SSL:</p><pre class="programlisting">
+binding.Security.Mode = AmqpSecurityMode.Transport;
+binding.Security.Transport.UseSSL = true;
+binding.BrokerPort = 5671;
+</pre><p>Currently the WCF client only provides SASL PLAIN (i.e. username and
+      password) authentication.  To provide a username and password, you can
+      set the DefaultAmqpCredential value in the binding.  This value can be
+      overridden or set for a binding's channel factories and listeners,
+      either by setting the ClientCredentials as a binding parameter, or by
+      using an AmqpCredential as a binding parameter.  The search order for
+      credentials is the AmqpCredential binding parameter, followed by the
+      ClientCredentials (unless IgnoreEndpointClientCredentials has been
+      set), and finally defaulting to the DefaultAmqpCredential of the
+      binding itself.  Here is a sample using ClientCredentials:</p><pre class="programlisting">
+ClientCredentials credentials = new ClientCredentials();
+credentials.UserName.UserName = "guest";
+credentials.UserName.Password = "guest";
+bindingParameters = new BindingParameterCollection();
+bindingParameters.Add(credentials);
+readerFactory = binding.BuildChannelFactory&lt;IInputChannel&gt;(bindingParameters);
+</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.3. Message Headers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4.5. Transactions</td></tr></table></div></body></html>



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org