qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jr...@apache.org
Subject [16/51] [partial] qpid-site git commit: QPID-7353: Update for the Qpid C++ 1.35.0 release
Date Tue, 06 Sep 2016 16:59:39 GMT
http://git-wip-us.apache.org/repos/asf/qpid-site/blob/eff0fe55/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/map_sender.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/map_sender.cpp.html b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/map_sender.cpp.html
new file mode 100644
index 0000000..b86e10c
--- /dev/null
+++ b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/map_sender.cpp.html
@@ -0,0 +1,199 @@
+<!DOCTYPE html>
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements.  See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership.  The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License.  You may obtain a copy of the License at
+ -
+ -   http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied.  See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>map_sender.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-cpp-1.35.0/index.html">Qpid C++ 1.35.0</a></li><li><a href="/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/index.html">C++ Messaging API Examples</a></li><li>map_sender.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>map_sender.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Connection.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Message.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Sender.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Session.h&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;cstdlib&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;sstream&gt;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="k">namespace</span> <span class="n">qpid</span><span class="o">::</span><span class="n">messaging</span><span class="p">;</span>
+<span class="k">using</span> <span class="k">namespace</span> <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="p">;</span>
+
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">;</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span><span class="o">&gt;</span><span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;amqp:tcp:127.0.0.1:5672&quot;</span><span class="p">;</span>
+    <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">address</span> <span class="o">=</span> <span class="n">argc</span><span class="o">&gt;</span><span class="mi">2</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;message_queue; {create: always}&quot;</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">connectionOptions</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">3</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;&quot;</span><span class="p">;</span>
+
+    <span class="n">Connection</span> <span class="n">connection</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">connectionOptions</span><span class="p">);</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">open</span><span class="p">();</span>
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="n">createSession</span><span class="p">();</span>
+        <span class="n">Sender</span> <span class="n">sender</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createSender</span><span class="p">(</span><span class="n">address</span><span class="p">);</span>
+
+        <span class="n">Message</span> <span class="n">message</span><span class="p">;</span>
+        <span class="n">Variant</span><span class="o">::</span><span class="n">Map</span> <span class="n">content</span><span class="p">;</span>
+        <span class="n">content</span><span class="p">[</span><span class="s">&quot;id&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">987654321</span><span class="p">;</span>
+        <span class="n">content</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Widget&quot;</span><span class="p">;</span>
+        <span class="n">content</span><span class="p">[</span><span class="s">&quot;percent&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.99</span><span class="p">;</span>
+        <span class="n">Variant</span><span class="o">::</span><span class="n">List</span> <span class="n">colours</span><span class="p">;</span>
+        <span class="n">colours</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Variant</span><span class="p">(</span><span class="s">&quot;red&quot;</span><span class="p">));</span>
+        <span class="n">colours</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Variant</span><span class="p">(</span><span class="s">&quot;green&quot;</span><span class="p">));</span>
+        <span class="n">colours</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Variant</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">));</span>
+        <span class="n">content</span><span class="p">[</span><span class="s">&quot;colours&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">colours</span><span class="p">;</span>
+        <span class="n">content</span><span class="p">[</span><span class="s">&quot;uuid&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Uuid</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
+        <span class="n">message</span><span class="p">.</span><span class="n">setContentObject</span><span class="p">(</span><span class="n">content</span><span class="p">);</span>
+
+        <span class="n">sender</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
+
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">error</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">error</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="map_sender.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/eff0fe55/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp
new file mode 100755
index 0000000..ba9fa9e
--- /dev/null
+++ b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp
@@ -0,0 +1,94 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qpid/messaging/Address.h>
+#include <qpid/messaging/Connection.h>
+#include <qpid/messaging/Message.h>
+#include <qpid/messaging/Receiver.h>
+#include <qpid/messaging/Sender.h>
+#include <qpid/messaging/Session.h>
+
+#include <algorithm>
+#include <cstdlib>
+#include <iostream>
+#include <memory>
+#include <sstream>
+
+using namespace qpid::messaging;
+
+using std::stringstream;
+using std::string;
+
+int main(int argc, char** argv) {
+    const char* url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
+    std::string connectionOptions = argc > 2 ? argv[2] : "";
+
+    Connection connection(url, connectionOptions);
+    try {
+        connection.open();
+        Session session = connection.createSession();
+        Receiver receiver = session.createReceiver("service_queue; {create: always}");
+
+        while (true) {
+            Message request = receiver.fetch();
+            const Address& address = request.getReplyTo();
+            if (address) {
+                Sender sender = session.createSender(address);
+                Message response;
+
+                qpid::types::Variant requestObj = request.getContentObject();
+                if (requestObj.getType() == qpid::types::VAR_STRING) {
+                    // Received a string.
+                    // Server returns request string in upper case with same encoding.
+                    std::string s = requestObj;
+                    std::transform(s.begin(), s.end(), s.begin(), toupper);
+                    qpid::types::Variant responseObj(s);
+                    responseObj.setEncoding( requestObj.getEncoding() );
+                    response.setContentObject( responseObj );
+                } else {
+                    // Received something other than a string.
+                    // Server echos received object as a utf8 string.
+                    qpid::types::Variant responseObj( requestObj.asString() );
+                    responseObj.setEncoding( "utf8" );
+                    response.setContentObject( requestObj );
+                }
+                sender.send(response);
+                std::cout << "Processed request: "
+                          << request.getContentObject()
+                          << " -> "
+                          << response.getContentObject() << std::endl;
+                session.acknowledge();
+                sender.close();
+            } else {
+                std::cerr << "Error: no reply address specified for request: " << request.getContent() << std::endl;
+                session.reject(request);
+            }
+        }
+        connection.close();
+        return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+        connection.close();
+    }
+    return 1;
+}
+
+

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/eff0fe55/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp.html b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp.html
new file mode 100644
index 0000000..768d04b
--- /dev/null
+++ b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server.cpp.html
@@ -0,0 +1,220 @@
+<!DOCTYPE html>
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements.  See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership.  The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License.  You may obtain a copy of the License at
+ -
+ -   http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied.  See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>server.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-cpp-1.35.0/index.html">Qpid C++ 1.35.0</a></li><li><a href="/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/index.html">C++ Messaging API Examples</a></li><li>server.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>server.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Address.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Connection.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Message.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Receiver.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Sender.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Session.h&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;algorithm&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;cstdlib&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;memory&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;sstream&gt;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="k">namespace</span> <span class="n">qpid</span><span class="o">::</span><span class="n">messaging</span><span class="p">;</span>
+
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">;</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span><span class="o">&gt;</span><span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;amqp:tcp:127.0.0.1:5672&quot;</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">connectionOptions</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">2</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;&quot;</span><span class="p">;</span>
+
+    <span class="n">Connection</span> <span class="n">connection</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">connectionOptions</span><span class="p">);</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">open</span><span class="p">();</span>
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="n">createSession</span><span class="p">();</span>
+        <span class="n">Receiver</span> <span class="n">receiver</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createReceiver</span><span class="p">(</span><span class="s">&quot;service_queue; {create: always}&quot;</span><span class="p">);</span>
+
+        <span class="k">while</span> <span class="p">(</span><span class="nb">true</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">Message</span> <span class="n">request</span> <span class="o">=</span> <span class="n">receiver</span><span class="p">.</span><span class="n">fetch</span><span class="p">();</span>
+            <span class="k">const</span> <span class="n">Address</span><span class="o">&amp;</span> <span class="n">address</span> <span class="o">=</span> <span class="n">request</span><span class="p">.</span><span class="n">getReplyTo</span><span class="p">();</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">address</span><span class="p">)</span> <span class="p">{</span>
+                <span class="n">Sender</span> <span class="n">sender</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createSender</span><span class="p">(</span><span class="n">address</span><span class="p">);</span>
+                <span class="n">Message</span> <span class="n">response</span><span class="p">;</span>
+
+                <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="o">::</span><span class="n">Variant</span> <span class="n">requestObj</span> <span class="o">=</span> <span class="n">request</span><span class="p">.</span><span class="n">getContentObject</span><span class="p">();</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">requestObj</span><span class="p">.</span><span class="n">getType</span><span class="p">()</span> <span class="o">==</span> <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="o">::</span><span class="n">VAR_STRING</span><span class="p">)</span> <span class="p">{</span>
+                    <span class="c1">// Received a string.</span>
+                    <span class="c1">// Server returns request string in upper case with same encoding.</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">s</span> <span class="o">=</span> <span class="n">requestObj</span><span class="p">;</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">transform</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">s</span><span class="p">.</span><span class="n">end</span><span class="p">(),</span> <span class="n">s</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">toupper</span><span class="p">);</span>
+                    <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="o">::</span><span class="n">Variant</span> <span class="n">responseObj</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
+                    <span class="n">responseObj</span><span class="p">.</span><span class="n">setEncoding</span><span class="p">(</span> <span class="n">requestObj</span><span class="p">.</span><span class="n">getEncoding</span><span class="p">()</span> <span class="p">);</span>
+                    <span class="n">response</span><span class="p">.</span><span class="n">setContentObject</span><span class="p">(</span> <span class="n">responseObj</span> <span class="p">);</span>
+                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                    <span class="c1">// Received something other than a string.</span>
+                    <span class="c1">// Server echos received object as a utf8 string.</span>
+                    <span class="n">qpid</span><span class="o">::</span><span class="n">types</span><span class="o">::</span><span class="n">Variant</span> <span class="n">responseObj</span><span class="p">(</span> <span class="n">requestObj</span><span class="p">.</span><span class="n">asString</span><span class="p">()</span> <span class="p">);</span>
+                    <span class="n">responseObj</span><span class="p">.</span><span class="n">setEncoding</span><span class="p">(</span> <span class="s">&quot;utf8&quot;</span> <span class="p">);</span>
+                    <span class="n">response</span><span class="p">.</span><span class="n">setContentObject</span><span class="p">(</span> <span class="n">requestObj</span> <span class="p">);</span>
+                <span class="p">}</span>
+                <span class="n">sender</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">response</span><span class="p">);</span>
+                <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Processed request: &quot;</span>
+                          <span class="o">&lt;&lt;</span> <span class="n">request</span><span class="p">.</span><span class="n">getContentObject</span><span class="p">()</span>
+                          <span class="o">&lt;&lt;</span> <span class="s">&quot; -&gt; &quot;</span>
+                          <span class="o">&lt;&lt;</span> <span class="n">response</span><span class="p">.</span><span class="n">getContentObject</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+                <span class="n">session</span><span class="p">.</span><span class="n">acknowledge</span><span class="p">();</span>
+                <span class="n">sender</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Error: no reply address specified for request: &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">request</span><span class="p">.</span><span class="n">getContent</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+                <span class="n">session</span><span class="p">.</span><span class="n">reject</span><span class="p">(</span><span class="n">request</span><span class="p">);</span>
+            <span class="p">}</span>
+        <span class="p">}</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">error</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">error</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="server.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/eff0fe55/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp
new file mode 100755
index 0000000..ab71477
--- /dev/null
+++ b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp
@@ -0,0 +1,97 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qpid/messaging/Address.h>
+#include <qpid/messaging/Connection.h>
+#include <qpid/messaging/exceptions.h>
+#include <qpid/messaging/Message.h>
+#include <qpid/messaging/Receiver.h>
+#include <qpid/messaging/Sender.h>
+#include <qpid/messaging/Session.h>
+
+#include <algorithm>
+#include <cstdlib>
+#include <iostream>
+#include <memory>
+#include <sstream>
+
+using namespace qpid::messaging;
+
+using std::stringstream;
+using std::string;
+
+int main(int argc, char** argv) {
+    std::string url = argc>1 ? argv[1] : "amqp:tcp:127.0.0.1:5672";
+    std::string connectionOptions = argc > 2 ? argv[2] : "";
+
+    Connection connection(url, connectionOptions);
+    try {
+        connection.open();
+        Session session = connection.createSession();
+        Receiver receiver = session.createReceiver("service_queue; {create: always}");
+
+        while (true) {
+            try {
+                if (!connection.isOpen()) {
+                    // This demonstrates use of application controlled
+                    // reconnect; the reconnect connection option may
+                    // also be used to automatcially handle
+                    // reconnection
+                    if (url.empty()) {
+                        connection.reconnect();
+                    } else {
+                        connection.reconnect(url);
+                    }
+                    std::cout << "Reconnected to " << connection.getUrl() << std::endl;
+                }
+                Message request = receiver.fetch();
+                const Address& address = request.getReplyTo();
+                if (address) {
+                    Sender sender = session.createSender(address);
+                    std::string s = request.getContent();
+                    std::transform(s.begin(), s.end(), s.begin(), toupper);
+                    Message response(s);
+                    sender.send(response);
+                    std::cout << "Processed request: "
+                              << request.getContent()
+                              << " -> "
+                              << response.getContent() << std::endl;
+                    session.acknowledge();
+                    sender.close();
+                } else {
+                    std::cerr << "Error: no reply address specified for request: " << request.getContent() << std::endl;
+                    session.reject(request);
+                }
+            } catch (const TransportFailure&) {
+                std::cout << "Connection to broker was lost, please enter URL to reconnect to (or hit return to use original url):" << std::endl;
+                if (!std::getline(std::cin, url)) {
+                    return 1;
+                }
+            }
+        }
+        connection.close();
+        return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+        connection.close();
+    }
+    return 1;
+}

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/eff0fe55/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp.html
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp.html b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp.html
new file mode 100644
index 0000000..106692f
--- /dev/null
+++ b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/server_reconnect.cpp.html
@@ -0,0 +1,225 @@
+<!DOCTYPE html>
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements.  See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership.  The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License.  You may obtain a copy of the License at
+ -
+ -   http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied.  See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+  <head>
+    <title>server_reconnect.cpp - Apache Qpid&#8482;</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <link rel="stylesheet" href="/site.css" type="text/css" async="async"/>
+    <link rel="stylesheet" href="/deferred.css" type="text/css" defer="defer"/>
+    <script type="text/javascript">var _deferredFunctions = [];</script>
+    <script type="text/javascript" src="/deferred.js" defer="defer"></script>
+    <!--[if lte IE 8]>
+      <link rel="stylesheet" href="/ie.css" type="text/css"/>
+      <script type="text/javascript" src="/html5shiv.js"></script>
+    <![endif]-->
+
+    <!-- Redirects for `go get` and godoc.org -->
+    <meta name="go-import"
+          content="qpid.apache.org git https://git-wip-us.apache.org/repos/asf/qpid-proton.git"/>
+    <meta name="go-source"
+          content="qpid.apache.org
+https://github.com/apache/qpid-proton/blob/go1/README.md
+https://github.com/apache/qpid-proton/tree/go1{/dir}
+https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/>
+  </head>
+  <body>
+    <div id="-content">
+      <div id="-top" class="panel">
+        <a id="-menu-link"><img width="16" height="16" src="" alt="Menu"/></a>
+
+        <a id="-search-link"><img width="22" height="16" src="" alt="Search"/></a>
+
+        <ul id="-global-navigation">
+          <li><a id="-logotype" href="/index.html">Apache Qpid<sup>&#8482;</sup></a></li>
+          <li><a href="/documentation.html">Documentation</a></li>
+          <li><a href="/download.html">Download</a></li>
+          <li><a href="/discussion.html">Discussion</a></li>
+        </ul>
+      </div>
+
+      <div id="-menu" class="panel" style="display: none;">
+        <div class="flex">
+          <section>
+            <h3>Project</h3>
+
+            <ul>
+              <li><a href="/overview.html">Overview</a></li>
+              <li><a href="/components/index.html">Components</a></li>
+              <li><a href="/releases/index.html">Releases</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Messaging APIs</h3>
+
+            <ul>
+              <li><a href="/proton/index.html">Qpid Proton</a></li>
+              <li><a href="/components/jms/index.html">Qpid JMS</a></li>
+              <li><a href="/components/messaging-api/index.html">Qpid Messaging API</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Servers and tools</h3>
+
+            <ul>
+              <li><a href="/components/java-broker/index.html">Broker for Java</a></li>
+              <li><a href="/components/cpp-broker/index.html">C++ broker</a></li>
+              <li><a href="/components/dispatch-router/index.html">Dispatch router</a></li>
+            </ul>
+          </section>
+
+          <section>
+            <h3>Resources</h3>
+
+            <ul>
+              <li><a href="/dashboard.html">Dashboard</a></li>
+              <li><a href="https://cwiki.apache.org/confluence/display/qpid/Index">Wiki</a></li>
+              <li><a href="/resources.html">More resources</a></li>
+            </ul>
+          </section>
+        </div>
+      </div>
+
+      <div id="-search" class="panel" style="display: none;">
+        <form action="http://www.google.com/search" method="get">
+          <input type="hidden" name="sitesearch" value="qpid.apache.org"/>
+          <input type="text" name="q" maxlength="255" autofocus="autofocus" tabindex="1"/>
+          <button type="submit">Search</button>
+          <a href="/search.html">More ways to search</a>
+        </form>
+      </div>
+
+      <div id="-middle" class="panel">
+        <ul id="-path-navigation"><li><a href="/index.html">Home</a></li><li><a href="/releases/index.html">Releases</a></li><li><a href="/releases/qpid-cpp-1.35.0/index.html">Qpid C++ 1.35.0</a></li><li><a href="/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/index.html">C++ Messaging API Examples</a></li><li>server_reconnect.cpp</li></ul>
+
+        <div id="-middle-content">
+          
+<h1>server_reconnect.cpp</h1>
+<div class="highlight"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Address.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Connection.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/exceptions.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Message.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Receiver.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Sender.h&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;qpid/messaging/Session.h&gt;</span><span class="cp"></span>
+
+<span class="cp">#include</span> <span class="cpf">&lt;algorithm&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;cstdlib&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;memory&gt;</span><span class="cp"></span>
+<span class="cp">#include</span> <span class="cpf">&lt;sstream&gt;</span><span class="cp"></span>
+
+<span class="k">using</span> <span class="k">namespace</span> <span class="n">qpid</span><span class="o">::</span><span class="n">messaging</span><span class="p">;</span>
+
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">stringstream</span><span class="p">;</span>
+<span class="k">using</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">;</span>
+
+<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">url</span> <span class="o">=</span> <span class="n">argc</span><span class="o">&gt;</span><span class="mi">1</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;amqp:tcp:127.0.0.1:5672&quot;</span><span class="p">;</span>
+    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">connectionOptions</span> <span class="o">=</span> <span class="n">argc</span> <span class="o">&gt;</span> <span class="mi">2</span> <span class="o">?</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">:</span> <span class="s">&quot;&quot;</span><span class="p">;</span>
+
+    <span class="n">Connection</span> <span class="n">connection</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">connectionOptions</span><span class="p">);</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">open</span><span class="p">();</span>
+        <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="n">createSession</span><span class="p">();</span>
+        <span class="n">Receiver</span> <span class="n">receiver</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createReceiver</span><span class="p">(</span><span class="s">&quot;service_queue; {create: always}&quot;</span><span class="p">);</span>
+
+        <span class="k">while</span> <span class="p">(</span><span class="nb">true</span><span class="p">)</span> <span class="p">{</span>
+            <span class="k">try</span> <span class="p">{</span>
+                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">connection</span><span class="p">.</span><span class="n">isOpen</span><span class="p">())</span> <span class="p">{</span>
+                    <span class="c1">// This demonstrates use of application controlled</span>
+                    <span class="c1">// reconnect; the reconnect connection option may</span>
+                    <span class="c1">// also be used to automatcially handle</span>
+                    <span class="c1">// reconnection</span>
+                    <span class="k">if</span> <span class="p">(</span><span class="n">url</span><span class="p">.</span><span class="n">empty</span><span class="p">())</span> <span class="p">{</span>
+                        <span class="n">connection</span><span class="p">.</span><span class="n">reconnect</span><span class="p">();</span>
+                    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                        <span class="n">connection</span><span class="p">.</span><span class="n">reconnect</span><span class="p">(</span><span class="n">url</span><span class="p">);</span>
+                    <span class="p">}</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Reconnected to &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">connection</span><span class="p">.</span><span class="n">getUrl</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+                <span class="p">}</span>
+                <span class="n">Message</span> <span class="n">request</span> <span class="o">=</span> <span class="n">receiver</span><span class="p">.</span><span class="n">fetch</span><span class="p">();</span>
+                <span class="k">const</span> <span class="n">Address</span><span class="o">&amp;</span> <span class="n">address</span> <span class="o">=</span> <span class="n">request</span><span class="p">.</span><span class="n">getReplyTo</span><span class="p">();</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">address</span><span class="p">)</span> <span class="p">{</span>
+                    <span class="n">Sender</span> <span class="n">sender</span> <span class="o">=</span> <span class="n">session</span><span class="p">.</span><span class="n">createSender</span><span class="p">(</span><span class="n">address</span><span class="p">);</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">s</span> <span class="o">=</span> <span class="n">request</span><span class="p">.</span><span class="n">getContent</span><span class="p">();</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">transform</span><span class="p">(</span><span class="n">s</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">s</span><span class="p">.</span><span class="n">end</span><span class="p">(),</span> <span class="n">s</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">toupper</span><span class="p">);</span>
+                    <span class="n">Message</span> <span class="n">response</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
+                    <span class="n">sender</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">response</span><span class="p">);</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Processed request: &quot;</span>
+                              <span class="o">&lt;&lt;</span> <span class="n">request</span><span class="p">.</span><span class="n">getContent</span><span class="p">()</span>
+                              <span class="o">&lt;&lt;</span> <span class="s">&quot; -&gt; &quot;</span>
+                              <span class="o">&lt;&lt;</span> <span class="n">response</span><span class="p">.</span><span class="n">getContent</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+                    <span class="n">session</span><span class="p">.</span><span class="n">acknowledge</span><span class="p">();</span>
+                    <span class="n">sender</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+                <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                    <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Error: no reply address specified for request: &quot;</span> <span class="o">&lt;&lt;</span> <span class="n">request</span><span class="p">.</span><span class="n">getContent</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+                    <span class="n">session</span><span class="p">.</span><span class="n">reject</span><span class="p">(</span><span class="n">request</span><span class="p">);</span>
+                <span class="p">}</span>
+            <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="k">const</span> <span class="n">TransportFailure</span><span class="o">&amp;</span><span class="p">)</span> <span class="p">{</span>
+                <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Connection to broker was lost, please enter URL to reconnect to (or hit return to use original url):&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">std</span><span class="o">::</span><span class="n">getline</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">cin</span><span class="p">,</span> <span class="n">url</span><span class="p">))</span> <span class="p">{</span>
+                    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+                <span class="p">}</span>
+            <span class="p">}</span>
+        <span class="p">}</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+        <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="p">}</span> <span class="k">catch</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">exception</span><span class="o">&amp;</span> <span class="n">error</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">error</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
+        <span class="n">connection</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+    <span class="p">}</span>
+    <span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+<p><a href="server_reconnect.cpp">Download this file</a></p>
+
+
+          <hr/>
+
+          <ul id="-apache-navigation">
+            <li><a href="http://www.apache.org/">Apache</a></li>
+            <li><a href="http://www.apache.org/licenses/">License</a></li>
+            <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+            <li><a href="http://www.apache.org/foundation/thanks.html">Thanks!</a></li>
+            <li><a href="/security.html">Security</a></li>
+            <li><a href="http://www.apache.org/"><img id="-apache-feather" width="48" height="14" src="" alt="Apache"/></a></li>
+          </ul>
+
+          <p id="-legal">
+            Apache Qpid, Messaging built on AMQP; Copyright &#169; 2015
+            The Apache Software Foundation; Licensed under
+            the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
+            License, Version 2.0</a>; Apache Qpid, Qpid, Qpid Proton,
+            Proton, Apache, the Apache feather logo, and the Apache Qpid
+            project logo are trademarks of The Apache Software
+            Foundation; All other marks mentioned may be trademarks or
+            registered trademarks of their respective owners
+          </p>
+        </div>
+      </div>
+    </div>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/qpid-site/blob/eff0fe55/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/spout.cpp
----------------------------------------------------------------------
diff --git a/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/spout.cpp b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/spout.cpp
new file mode 100755
index 0000000..ba5ffb2
--- /dev/null
+++ b/content/releases/qpid-cpp-1.35.0/messaging-api/cpp/examples/spout.cpp
@@ -0,0 +1,190 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include <qpid/messaging/Address.h>
+#include <qpid/messaging/Connection.h>
+#include <qpid/messaging/Message.h>
+#include <qpid/messaging/Message_io.h>
+#include <qpid/messaging/Sender.h>
+#include <qpid/messaging/Session.h>
+#include <qpid/types/Variant.h>
+
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <ctime>
+
+#include "OptionParser.h"
+
+using namespace qpid::messaging;
+using namespace qpid::types;
+
+typedef std::vector<std::string> string_vector;
+
+struct Options : OptionParser
+{
+    std::string url;
+    std::string address;
+    int timeout;
+    bool durable;
+    int count;
+    std::string id;
+    std::string replyto;
+    string_vector properties;
+    string_vector entries;
+    std::string content;
+    std::string connectionOptions;
+    bool print;
+
+    Options()
+        : OptionParser("Usage: spout [OPTIONS] ADDRESS", "Send messages to the specified address"),
+          url("127.0.0.1"),
+          timeout(0),
+          count(1),
+          durable(false),
+          print(false)
+    {
+        add("broker,b", url, "url of broker to connect to");
+        add("timeout,t", timeout, "exit after the specified time");
+        add("durable,d", durable, "make the message durable (def. transient)");
+        add("count,c", count, "stop after count messages have been sent, zero disables");
+        add("id,i", id, "use the supplied id instead of generating one");
+        add("reply-to", replyto, "specify reply-to address");
+        add("property,P", properties, "specify message property");
+        add("map,M", entries, "specify entry for map content");
+        add("content", content, "specify textual content");
+        add("connection-options", connectionOptions, "connection options string in the form {name1:value1, name2:value2}");
+        add("print", print, "print each message sent");
+    }
+
+    static bool nameval(const std::string& in, std::string& name, std::string& value)
+    {
+        std::string::size_type i = in.find("=");
+        if (i == std::string::npos) {
+            name = in;
+            return false;
+        } else {
+            name = in.substr(0, i);
+            if (i+1 < in.size()) {
+                value = in.substr(i+1);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    static void setProperty(Message& message, const std::string& property)
+    {
+        std::string name;
+        std::string value;
+        if (nameval(property, name, value)) {
+            message.getProperties()[name] = value;
+            message.getProperties()[name].setEncoding("utf8");
+        } else {
+            message.getProperties()[name] = Variant();
+        }
+    }
+
+    void setProperties(Message& message) const
+    {
+        for (string_vector::const_iterator i = properties.begin(); i != properties.end(); ++i) {
+            setProperty(message, *i);
+        }
+    }
+
+    void setEntries(Variant::Map& content) const
+    {
+        for (string_vector::const_iterator i = entries.begin(); i != entries.end(); ++i) {
+            std::string name;
+            std::string value;
+            if (nameval(*i, name, value)) {
+                content[name] = value;
+            } else {
+                content[name] = Variant();
+            }
+        }
+    }
+
+    bool checkAddress()
+    {
+        if (getArguments().empty()) {
+            error("Address is required");
+            return false;
+        } else {
+            address = getArguments()[0];
+            return true;
+        }
+    }
+
+    bool isDurable() const
+    {
+      return durable;
+    }
+};
+
+int main(int argc, char** argv)
+{
+    Options options;
+    if (options.parse(argc, argv) && options.checkAddress()) {
+        Connection connection(options.url, options.connectionOptions);
+        try {
+            connection.open();
+            Session session = connection.createSession();
+            Sender sender = session.createSender(options.address);
+
+            Message message;
+            message.setDurable(options.isDurable());
+            options.setProperties(message);
+            Variant& obj = message.getContentObject();
+            if (options.entries.size()) {
+                Variant::Map content;
+                options.setEntries(content);
+                obj = content;
+            } else if (options.content.size()) {
+                obj = options.content;
+                obj.setEncoding("utf8");
+            }
+            std::time_t start = std::time(0);
+            for (int count = 0; 
+                (count < options.count || options.count == 0) && 
+                (options.timeout == 0 || std::difftime(std::time(0), start) < options.timeout); 
+                count++) {
+                if (!options.replyto.empty()) message.setReplyTo(Address(options.replyto));
+                std::string id = options.id.empty() ? Uuid(true).str() : options.id;
+                std::stringstream spoutid;
+                spoutid << id << ":" << count;
+                message.getProperties()["spout-id"] = spoutid.str();
+                if (options.print) std::cout << message << std::endl;
+                sender.send(message);
+            }
+            session.sync();
+            connection.close();
+            return 0;
+        } catch(const std::exception& error) {
+            std::cout << error.what() << std::endl;
+            connection.close();
+        }
+    }
+    return 1;
+}
+
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message