Update site for Qpid JMS AMQP 0-x release 6.3.2
Project: http://git-wip-us.apache.org/repos/asf/qpid-site/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-site/commit/b3a90a4a Tree: http://git-wip-us.apache.org/repos/asf/qpid-site/tree/b3a90a4a Diff: http://git-wip-us.apache.org/repos/asf/qpid-site/diff/b3a90a4a Branch: refs/heads/asf-site Commit: b3a90a4ae4f942111083c0407498dfe4bea1e551 Parents: 18a7a34 Author: Alex Rudyy <[email protected]> Authored: Thu Jul 19 16:50:37 2018 +0100 Committer: Alex Rudyy <[email protected]> Committed: Thu Jul 19 16:50:37 2018 +0100 ---------------------------------------------------------------------- content/components/jms/amqp-0-x.html | 10 +- content/download.html | 6 +- content/maven.html | 2 +- content/releases/index.html | 3 +- .../releases/qpid-jms-amqp-0-x-6.3.0/index.html | 2 +- .../releases/qpid-jms-amqp-0-x-6.3.1/index.html | 2 +- .../qpid-jms-amqp-0-x-6.3.2/examples/Drain.java | 103 +++ .../examples/Drain.java.html | 232 ++++++ .../qpid-jms-amqp-0-x-6.3.2/examples/Hello.java | 83 +++ .../examples/Hello.java.html | 211 ++++++ .../examples/ListReceiver.java | 101 +++ .../examples/ListReceiver.java.html | 229 ++++++ .../examples/ListSender.java | 86 +++ .../examples/ListSender.java.html | 214 ++++++ .../examples/MapReceiver.java | 52 ++ .../examples/MapReceiver.java.html | 180 +++++ .../examples/MapSender.java | 83 +++ .../examples/MapSender.java.html | 211 ++++++ .../examples/OptionParser.java | 351 +++++++++ .../examples/OptionParser.java.html | 480 ++++++++++++ .../qpid-jms-amqp-0-x-6.3.2/examples/Spout.java | 149 ++++ .../examples/Spout.java.html | 278 +++++++ .../examples/hello.properties | 28 + .../examples/hello.properties.html | 158 ++++ .../qpid-jms-amqp-0-x-6.3.2/examples/index.html | 166 +++++ .../releases/qpid-jms-amqp-0-x-6.3.2/index.html | 215 ++++++ .../JMS-Client-0-10-Book.html | 144 ++++ .../JMS-Client-0-10-Configuring-Addresses.html | 727 +++++++++++++++++++ .../JMS-Client-0-10-Configuring-JNDI.html | 432 +++++++++++ ...-Client-0-10-Configuring-JVM-Properties.html | 186 +++++ .../JMS-Client-0-10-Configuring-Logging.html | 152 ++++ .../JMS-Client-0-10-Configuring.html | 154 ++++ .../JMS-Client-0-10-Example.html | 221 ++++++ ...S-Client-0-10-Miscellaneous-MapMessages.html | 191 +++++ .../JMS-Client-0-10-Miscellaneous.html | 151 ++++ .../jms-amqp-0-10-book/css/style.css | 131 ++++ .../jms-amqp-0-10-book/index.html | 144 ++++ .../JMS-Client-0-8-Appendix-Exceptions.html | 197 +++++ ...ent-0-8-Appendix-JMS-Extensions-Binding.html | 163 +++++ .../JMS-Client-0-8-Appendix-JMS-Extensions.html | 158 ++++ .../JMS-Client-0-8-Appendix-Maven.html | 175 +++++ ...t-0-8-Appendix-PooledConnecytionFactory.html | 195 +++++ ...0-8-Appendix-ProducerFlowControl-Impact.html | 183 +++++ ...nt-0-8-Appendix-Tomcat-JNDI-Integration.html | 266 +++++++ .../JMS-Client-0-8-Binding-URL.html | 222 ++++++ ...ent-0-8-Client-Understanding-Connection.html | 215 ++++++ ...-Client-Understanding-ConnectionFactory.html | 151 ++++ ...t-0-8-Client-Understanding-Destinations.html | 149 ++++ ...-8-Client-Understanding-MessageConsumer.html | 171 +++++ ...-8-Client-Understanding-MessageProducer.html | 190 +++++ ...Client-0-8-Client-Understanding-Session.html | 208 ++++++ .../JMS-Client-0-8-Client-Understanding.html | 150 ++++ .../JMS-Client-0-8-Connection-URL.html | 269 +++++++ ...-8-Document-Scope-And-Intended-Audience.html | 161 ++++ .../JMS-Client-0-8-Examples-PubSub.html | 216 ++++++ .../JMS-Client-0-8-Examples.html | 218 ++++++ .../JMS-Client-0-8-Introduction.html | 153 ++++ ...S-Getting-And-Dependencies-Dependencies.html | 148 ++++ ...Client-0-8-JMS-Getting-And-Dependencies.html | 154 ++++ ...-0-8-JNDI-Properties-Format-Destination.html | 146 ++++ ...Client-0-8-JNDI-Properties-Format-Queue.html | 145 ++++ ...Client-0-8-JNDI-Properties-Format-Topic.html | 147 ++++ .../JMS-Client-0-8-JNDI-Properties-Format.html | 157 ++++ ...Client-0-8-Logging-EnablingDebugLogging.html | 151 ++++ .../JMS-Client-0-8-Logging.html | 155 ++++ .../JMS-Client-0-8-System-Properties.html | 280 +++++++ .../jms-amqp-0-8-book/JMS-Client-Book.html | 150 ++++ .../JMS-Client-Message-Encryption-Example.html | 326 +++++++++ ...JMS-Client-Message-Encryption-Receiving.html | 154 ++++ .../JMS-Client-Message-Encryption-Sending.html | 203 ++++++ .../JMS-Client-Message-Encryption.html | 177 +++++ .../jms-amqp-0-8-book/css/style.css | 131 ++++ .../jms-amqp-0-8-book/images/JndiOverview.png | Bin 0 -> 67726 bytes .../jms-amqp-0-8-book/images/JndiOverview.svg | 23 + .../images/QpidJmsOverview.png | Bin 0 -> 52377 bytes .../images/QpidJmsOverview.svg | 23 + .../jms-amqp-0-8-book/index.html | 150 ++++ .../qpid-jms-amqp-0-x-6.3.2/release-notes.html | 156 ++++ .../qpid-jms-amqp-0-x-master/index.html | 2 +- input/_transom_config.py | 2 +- input/releases/index.md | 3 +- .../qpid-jms-amqp-0-x-6.3.2/examples/Drain.java | 103 +++ .../examples/Drain.java.html.in | 88 +++ .../qpid-jms-amqp-0-x-6.3.2/examples/Hello.java | 83 +++ .../examples/Hello.java.html.in | 67 ++ .../examples/ListReceiver.java | 101 +++ .../examples/ListReceiver.java.html.in | 85 +++ .../examples/ListSender.java | 86 +++ .../examples/ListSender.java.html.in | 70 ++ .../examples/MapReceiver.java | 52 ++ .../examples/MapReceiver.java.html.in | 36 + .../examples/MapSender.java | 83 +++ .../examples/MapSender.java.html.in | 67 ++ .../examples/OptionParser.java | 351 +++++++++ .../examples/OptionParser.java.html.in | 336 +++++++++ .../qpid-jms-amqp-0-x-6.3.2/examples/Spout.java | 149 ++++ .../examples/Spout.java.html.in | 134 ++++ .../examples/hello.properties | 28 + .../examples/hello.properties.html.in | 14 + .../qpid-jms-amqp-0-x-6.3.2/examples/index.md | 19 + input/releases/qpid-jms-amqp-0-x-6.3.2/index.md | 69 ++ .../JMS-Client-0-10-Book.html.in | 1 + ...MS-Client-0-10-Configuring-Addresses.html.in | 584 +++++++++++++++ .../JMS-Client-0-10-Configuring-JNDI.html.in | 289 ++++++++ ...ient-0-10-Configuring-JVM-Properties.html.in | 43 ++ .../JMS-Client-0-10-Configuring-Logging.html.in | 9 + .../JMS-Client-0-10-Configuring.html.in | 11 + .../JMS-Client-0-10-Example.html.in | 78 ++ ...lient-0-10-Miscellaneous-MapMessages.html.in | 48 ++ .../JMS-Client-0-10-Miscellaneous.html.in | 8 + .../jms-amqp-0-10-book/css/style.css | 131 ++++ .../jms-amqp-0-10-book/index.html.in | 1 + .../JMS-Client-0-8-Appendix-Exceptions.html.in | 54 ++ ...-0-8-Appendix-JMS-Extensions-Binding.html.in | 20 + ...S-Client-0-8-Appendix-JMS-Extensions.html.in | 15 + .../JMS-Client-0-8-Appendix-Maven.html.in | 32 + ...-8-Appendix-PooledConnecytionFactory.html.in | 52 ++ ...-Appendix-ProducerFlowControl-Impact.html.in | 40 + ...0-8-Appendix-Tomcat-JNDI-Integration.html.in | 123 ++++ .../JMS-Client-0-8-Binding-URL.html.in | 79 ++ ...-0-8-Client-Understanding-Connection.html.in | 72 ++ ...ient-Understanding-ConnectionFactory.html.in | 8 + ...-8-Client-Understanding-Destinations.html.in | 6 + ...Client-Understanding-MessageConsumer.html.in | 28 + ...Client-Understanding-MessageProducer.html.in | 47 ++ ...ent-0-8-Client-Understanding-Session.html.in | 65 ++ .../JMS-Client-0-8-Client-Understanding.html.in | 7 + .../JMS-Client-0-8-Connection-URL.html.in | 126 ++++ ...Document-Scope-And-Intended-Audience.html.in | 18 + .../JMS-Client-0-8-Examples-PubSub.html.in | 73 ++ .../JMS-Client-0-8-Examples.html.in | 75 ++ .../JMS-Client-0-8-Introduction.html.in | 10 + ...etting-And-Dependencies-Dependencies.html.in | 5 + ...ent-0-8-JMS-Getting-And-Dependencies.html.in | 11 + ...8-JNDI-Properties-Format-Destination.html.in | 3 + ...ent-0-8-JNDI-Properties-Format-Queue.html.in | 2 + ...ent-0-8-JNDI-Properties-Format-Topic.html.in | 4 + ...MS-Client-0-8-JNDI-Properties-Format.html.in | 14 + ...ent-0-8-Logging-EnablingDebugLogging.html.in | 8 + .../JMS-Client-0-8-Logging.html.in | 12 + .../JMS-Client-0-8-System-Properties.html.in | 137 ++++ .../jms-amqp-0-8-book/JMS-Client-Book.html.in | 7 + ...MS-Client-Message-Encryption-Example.html.in | 183 +++++ ...-Client-Message-Encryption-Receiving.html.in | 11 + ...MS-Client-Message-Encryption-Sending.html.in | 60 ++ .../JMS-Client-Message-Encryption.html.in | 34 + .../jms-amqp-0-8-book/css/style.css | 131 ++++ .../jms-amqp-0-8-book/images/JndiOverview.png | Bin 0 -> 67726 bytes .../jms-amqp-0-8-book/images/JndiOverview.svg | 23 + .../images/QpidJmsOverview.png | Bin 0 -> 52377 bytes .../images/QpidJmsOverview.svg | 23 + .../jms-amqp-0-8-book/index.html.in | 7 + .../qpid-jms-amqp-0-x-6.3.2/release-notes.md | 32 + 153 files changed, 17927 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/components/jms/amqp-0-x.html ---------------------------------------------------------------------- diff --git a/content/components/jms/amqp-0-x.html b/content/components/jms/amqp-0-x.html index e004f15..6a613f4 100644 --- a/content/components/jms/amqp-0-x.html +++ b/content/components/jms/amqp-0-x.html @@ -143,10 +143,10 @@ https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/> <ul> <li><a href="http://docs.oracle.com/javaee/1.4/api/javax/jms/package-summary.html">API reference</a></li> -<li><a href="/releases/qpid-jms-amqp-0-x-6.3.1/jms-amqp-0-10-book/index.html">Using the Qpid JMS AMQP 0-x - AMQP 0-10</a></li> -<li><a href="/releases/qpid-jms-amqp-0-x-6.3.1/jms-amqp-0-8-book/index.html">Using the Qpid JMS AMQP 0-x - AMQP 0-9-1, 0-9, 0-8</a></li> -<li><a href="/releases/qpid-jms-amqp-0-x-6.3.1/examples/index.html">Examples (AMQP 0-10)</a></li> -<li><a href="/releases/qpid-jms-amqp-0-x-6.3.1/jms-amqp-0-8-book/JMS-Client-0-8-Examples.html">Examples (AMQP 0-9-1, 0-9, 0-8)</a></li> +<li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/jms-amqp-0-10-book/index.html">Using the Qpid JMS AMQP 0-x - AMQP 0-10</a></li> +<li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/jms-amqp-0-8-book/index.html">Using the Qpid JMS AMQP 0-x - AMQP 0-9-1, 0-9, 0-8</a></li> +<li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/examples/index.html">Examples (AMQP 0-10)</a></li> +<li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/jms-amqp-0-8-book/JMS-Client-0-8-Examples.html">Examples (AMQP 0-9-1, 0-9, 0-8)</a></li> </ul> </div> @@ -158,7 +158,7 @@ https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/> <h2 id="releases">Releases</h2> <ul> -<li><a href="/releases/qpid-jms-amqp-0-x-6.3.1">Qpid JMS for AMQP 0-x 6.3.1</a></li> +<li><a href="/releases/qpid-jms-amqp-0-x-6.3.2">Qpid JMS for AMQP 0-x 6.3.2</a></li> <li><a href="/releases/index.html#past-releases">Past releases</a></li> </ul> http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/download.html ---------------------------------------------------------------------- diff --git a/content/download.html b/content/download.html index cc62613..3a366d7 100644 --- a/content/download.html +++ b/content/download.html @@ -153,9 +153,9 @@ https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/> </tr> <tr> <td><a href="/components/jms/amqp-0-x.html">Qpid JMS AMQP 0-x</a></td> - <td>6.3.1</td> - <td><a href="http://www.apache.org/dyn/closer.lua/qpid/jms-amqp-0-x/6.3.1/apache-qpid-jms-amqp-0-x-6.3.1-src.tar.gz">Source</a> (<a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.1/apache-qpid-jms-amqp-0-x-6.3.1-src.tar.gz.asc">ASC</a>, <a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.1/apache-qpid-jms-amqp-0-x-6.3.1-src.tar.gz.sha512">SHA512</a>), <a href="http://www.apache.org/dyn/closer.lua/qpid/jms-amqp-0-x/6.3.1/binaries/apache-qpid-jms-amqp-0-x-6.3.1-bin.tar.gz">Binary</a> (<a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.1/binaries/apache-qpid-jms-amqp-0-x-6.3.1-bin.tar.gz.asc">ASC</a>, <a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.1/binaries/apache-qpid-jms-amqp-0-x-6.3.1-bin.tar.gz.sha512">SHA512</a>)</td> - <td><a href="/releases/qpid-jms-amqp-0-x-6.3.1/index.html">Release Page</a>, <a href="maven.html">Maven</a></td> + <td>6.3.2</td> + <td><a href="http://www.apache.org/dyn/closer.lua/qpid/jms-amqp-0-x/6.3.2/apache-qpid-jms-amqp-0-x-6.3.2-src.tar.gz">Source</a> (<a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.2/apache-qpid-jms-amqp-0-x-6.3.2-src.tar.gz.asc">ASC</a>, <a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.2/apache-qpid-jms-amqp-0-x-6.3.2-src.tar.gz.sha512">SHA512</a>), <a href="http://www.apache.org/dyn/closer.lua/qpid/jms-amqp-0-x/6.3.2/binaries/apache-qpid-jms-amqp-0-x-6.3.2-bin.tar.gz">Binary</a> (<a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.2/binaries/apache-qpid-jms-amqp-0-x-6.3.2-bin.tar.gz.asc">ASC</a>, <a href="https://www.apache.org/dist/qpid/jms-amqp-0-x/6.3.2/binaries/apache-qpid-jms-amqp-0-x-6.3.2-bin.tar.gz.sha512">SHA512</a>)</td> + <td><a href="/releases/qpid-jms-amqp-0-x-6.3.2/index.html">Release Page</a>, <a href="maven.html">Maven</a></td> </tr> <tr> <td><a href="/components/messaging-api/index.html">Qpid Messaging API</a> C++</td> http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/maven.html ---------------------------------------------------------------------- diff --git a/content/maven.html b/content/maven.html index ca0af53..f89859a 100644 --- a/content/maven.html +++ b/content/maven.html @@ -134,7 +134,7 @@ https://github.com/apache/qpid-proton/blob/go1{/dir}/{file}#L{line}"/> <span class="nt"><dependency></span> <span class="nt"><groupId></span>org.apache.qpid<span class="nt"></groupId></span> <span class="nt"><artifactId></span>qpid-client<span class="nt"></artifactId></span> - <span class="nt"><version></span>6.3.1<span class="nt"></version></span> + <span class="nt"><version></span>6.3.2<span class="nt"></version></span> <span class="nt"></dependency></span> <span class="nt"><dependency></span> <span class="nt"><groupId></span>org.apache.geronimo.specs<span class="nt"></groupId></span> http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/index.html ---------------------------------------------------------------------- diff --git a/content/releases/index.html b/content/releases/index.html index 4a9f27d..673fe7c 100644 --- a/content/releases/index.html +++ b/content/releases/index.html @@ -126,13 +126,13 @@ the <div class="two-column"> <ul> +<li><a href="qpid-jms-amqp-0-x-6.3.2/index.html">Qpid JMS AMQP 0-x 6.3.2</a>, July 2017</li> <li><a href="qpid-proton-j-0.28.0/index.html">Qpid Proton-J 0.28.0</a>, July 2018</li> <li><a href="qpid-proton-j-0.27.2/index.html">Qpid Proton-J 0.27.2</a>, July 2018</li> <li><a href="qpid-dispatch-1.2.0/index.html">Qpid Dispatch 1.2.0</a>, July 2018</li> <li><a href="qpid-proton-0.24.0/index.html">Qpid Proton 0.24.0</a>, June 2018</li> <li><a href="qpid-jms-0.34.0/index.html">Qpid JMS 0.34.0</a>, June 2018</li> <li><a href="qpid-broker-j-7.0.6/index.html">Qpid Broker-J 7.0.6</a>, June 2018</li> -<li><a href="qpid-jms-amqp-0-x-6.3.1/index.html">Qpid JMS AMQP 0-x 6.3.1</a>, May 2017</li> <li><a href="qpid-java-6.1.6/index.html">Qpid for Java 6.1.6</a>, April 2018</li> <li><a href="qpid-cpp-1.38.0/index.html">Qpid C++ 1.38.0</a>, March 2018</li> <li><a href="qpid-python-1.37.0/index.html">Qpid Python 1.37.0</a>, November 2017</li> @@ -146,6 +146,7 @@ the <div class="two-column"> <ul> +<li><a href="qpid-jms-amqp-0-x-6.3.1/index.html">Qpid JMS AMQP 0-x 6.3.1</a>, May 2017</li> <li><a href="qpid-dispatch-1.1.0/index.html">Qpid Dispatch 1.1.0</a>, June 2018</li> <li><a href="qpid-jms-0.33.0/index.html">Qpid JMS 0.33.0</a>, June 2018</li> <li><a href="qpid-broker-j-7.0.5/index.html">Qpid Broker-J 7.0.5</a>, June 2018</li> http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.0/index.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.0/index.html b/content/releases/qpid-jms-amqp-0-x-6.3.0/index.html index 76be3f3..f637ae0 100644 --- a/content/releases/qpid-jms-amqp-0-x-6.3.0/index.html +++ b/content/releases/qpid-jms-amqp-0-x-6.3.0/index.html @@ -180,7 +180,7 @@ files you download.</p> <script type="text/javascript"> _deferredFunctions.push(function() { - if ("6.3.0" === "6.3.1") { + if ("6.3.0" === "6.3.2") { _modifyCurrentReleaseLinks(); } }); http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.1/index.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.1/index.html b/content/releases/qpid-jms-amqp-0-x-6.3.1/index.html index 26c1b22..49d2c55 100644 --- a/content/releases/qpid-jms-amqp-0-x-6.3.1/index.html +++ b/content/releases/qpid-jms-amqp-0-x-6.3.1/index.html @@ -180,7 +180,7 @@ files you download.</p> <script type="text/javascript"> _deferredFunctions.push(function() { - if ("6.3.1" === "6.3.1") { + if ("6.3.1" === "6.3.2") { _modifyCurrentReleaseLinks(); } }); http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java new file mode 100755 index 0000000..f0eb83a --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java @@ -0,0 +1,103 @@ +/* + * + * 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. + * + */ +package org.apache.qpid.example; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.Session; + +import org.apache.qpid.client.AMQAnyDestination; + +public class Drain extends OptionParser +{ + + static final Option FOREVER = new Option("f", + "forever", + "ignore timeout and wait forever", + null, + null, + Boolean.class); + + static final Option COUNT = new Option ("c", + "count", + "read c messages, then exit", + "COUNT", + "0", + Integer.class); + + + static + { + addOption(BROKER); + addOption(HELP); + addOption(TIMEOUT); + addOption(FOREVER); + addOption(COUNT); + addOption(CON_OPTIONS); + addOption(BROKER_OPTIONS); + } + + public Drain(String[] args, String usage, String desc) throws Exception + { + super(args, usage, desc); + + Connection con = createConnection(); + con.start(); + Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE); + Destination dest = new AMQAnyDestination(getAddress()); + MessageConsumer consumer = ssn.createConsumer(dest); + Message msg; + + long timeout = -1; + int count = 0; + int i = 0; + + if (containsOp(TIMEOUT)) { timeout = Integer.parseInt(getOp(TIMEOUT))*1000; } + if (containsOp(FOREVER)) { timeout = 0; } + if (containsOp(COUNT)) { count = Integer.parseInt(getOp(COUNT)); } + + while ((msg = consumer.receive(timeout)) != null) + { + System.out.println("\n------------- Msg -------------"); + System.out.println(msg); + System.out.println("-------------------------------\n"); + + if (count > 0) { + if (++i == count) { + break; + } + } + } + consumer.close(); + ssn.close(); + con.close(); + } + + public static void main(String[] args) throws Exception + { + String u = "Usage: drain [OPTIONS] 'ADDRESS'"; + String d = "Drains messages from the specified address."; + + new Drain(args,u,d); + } +} http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java.html b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java.html new file mode 100644 index 0000000..faade33 --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Drain.java.html @@ -0,0 +1,232 @@ +<!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>Drain.java - Apache Qpid™</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>™</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/broker-j/index.html">Broker-J</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-jms-amqp-0-x-6.3.2/index.html">Qpid JMS AMQP 0-x 6.3.2</a></li><li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/examples/index.html">Qpid JMS AMQP 0-x Examples</a></li><li>Drain.java</li></ul> + + <div id="-middle-content"> + +<h1>Drain.java</h1> +<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Message</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span> + +<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Drain</span> <span class="kd">extends</span> <span class="n">OptionParser</span> +<span class="o">{</span> + + <span class="kd">static</span> <span class="kd">final</span> <span class="n">Option</span> <span class="n">FOREVER</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Option</span><span class="o">(</span><span class="s">"f"</span><span class="o">,</span> + <span class="s">"forever"</span><span class="o">,</span> + <span class="s">"ignore timeout and wait forever"</span><span class="o">,</span> + <span class="kc">null</span><span class="o">,</span> + <span class="kc">null</span><span class="o">,</span> + <span class="n">Boolean</span><span class="o">.</span><span class="na">class</span><span class="o">);</span> + + <span class="kd">static</span> <span class="kd">final</span> <span class="n">Option</span> <span class="n">COUNT</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Option</span> <span class="o">(</span><span class="s">"c"</span><span class="o">,</span> + <span class="s">"count"</span><span class="o">,</span> + <span class="s">"read c messages, then exit"</span><span class="o">,</span> + <span class="s">"COUNT"</span><span class="o">,</span> + <span class="s">"0"</span><span class="o">,</span> + <span class="n">Integer</span><span class="o">.</span><span class="na">class</span><span class="o">);</span> + + + <span class="kd">static</span> + <span class="o">{</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">BROKER</span><span class="o">);</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">HELP</span><span class="o">);</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">TIMEOUT</span><span class="o">);</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">FOREVER</span><span class="o">);</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">COUNT</span><span class="o">);</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">CON_OPTIONS</span><span class="o">);</span> + <span class="n">addOption</span><span class="o">(</span><span class="n">BROKER_OPTIONS</span><span class="o">);</span> + <span class="o">}</span> + + <span class="kd">public</span> <span class="nf">Drain</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">,</span> <span class="n">String</span> <span class="n">usage</span><span class="o">,</span> <span class="n">String</span> <span class="n">desc</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> + <span class="o">{</span> + <span class="kd">super</span><span class="o">(</span><span class="n">args</span><span class="o">,</span> <span class="n">usage</span><span class="o">,</span> <span class="n">desc</span><span class="o">);</span> + + <span class="n">Connection</span> <span class="n">con</span> <span class="o">=</span> <span class="n">createConnection</span><span class="o">();</span> + <span class="n">con</span><span class="o">.</span><span class="na">start</span><span class="o">();</span> + <span class="n">Session</span> <span class="n">ssn</span> <span class="o">=</span> <span class="n">con</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span><span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span> + <span class="n">Destination</span> <span class="n">dest</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="n">getAddress</span><span class="o">());</span> + <span class="n">MessageConsumer</span> <span class="n">consumer</span> <span class="o">=</span> <span class="n">ssn</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">dest</span><span class="o">);</span> + <span class="n">Message</span> <span class="n">msg</span><span class="o">;</span> + + <span class="kt">long</span> <span class="n">timeout</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="o">;</span> + <span class="kt">int</span> <span class="n">count</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> + <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> + + <span class="k">if</span> <span class="o">(</span><span class="n">containsOp</span><span class="o">(</span><span class="n">TIMEOUT</span><span class="o">))</span> <span class="o">{</span> <span class="n">timeout</span> <span class="o">=</span> <span class="n">Integer</span><span class="o">.</span><span class="na">parseInt</span><span class="o">(</span><span class="n">getOp</span><span class="o">(</span><span class="n">TIMEOUT</span><span class="o">))*</span><span class="mi">1000</span><span class="o">;</span> <span class="o">}</span> + <span class="k">if</span> <span class="o">(</span><span class="n">containsOp</span><span class="o">(</span><span class="n">FOREVER</span><span class="o">))</span> <span class="o">{</span> <span class="n">timeout</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="o">}</span> + <span class="k">if</span> <span class="o">(</span><span class="n">containsOp</span><span class="o">(</span><span class="n">COUNT</span><span class="o">))</span> <span class="o">{</span> <span class="n">count</span> <span class="o">=</span> <span class="n">Integer</span><span class="o">.</span><span class="na">parseInt</span><span class="o">(</span><span class="n">getOp</span><span class="o">(</span><span class="n">COUNT</span><span class="o">));</span> <span class="o">}</span> + + <span class="k">while</span> <span class="o">((</span><span class="n">msg</span> <span class="o">=</span> <span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">(</span><span class="n">timeout</span><span class="o">))</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> + <span class="o">{</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"\n------------- Msg -------------"</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">msg</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"-------------------------------\n"</span><span class="o">);</span> + + <span class="k">if</span> <span class="o">(</span><span class="n">count</span> <span class="o">></span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span> + <span class="k">if</span> <span class="o">(++</span><span class="n">i</span> <span class="o">==</span> <span class="n">count</span><span class="o">)</span> <span class="o">{</span> + <span class="k">break</span><span class="o">;</span> + <span class="o">}</span> + <span class="o">}</span> + <span class="o">}</span> + <span class="n">consumer</span><span class="o">.</span><span class="na">close</span><span class="o">();</span> + <span class="n">ssn</span><span class="o">.</span><span class="na">close</span><span class="o">();</span> + <span class="n">con</span><span class="o">.</span><span class="na">close</span><span class="o">();</span> + <span class="o">}</span> + + <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> + <span class="o">{</span> + <span class="n">String</span> <span class="n">u</span> <span class="o">=</span> <span class="s">"Usage: drain [OPTIONS] 'ADDRESS'"</span><span class="o">;</span> + <span class="n">String</span> <span class="n">d</span> <span class="o">=</span> <span class="s">"Drains messages from the specified address."</span><span class="o">;</span> + + <span class="k">new</span> <span class="n">Drain</span><span class="o">(</span><span class="n">args</span><span class="o">,</span><span class="n">u</span><span class="o">,</span><span class="n">d</span><span class="o">);</span> + <span class="o">}</span> +<span class="o">}</span> +</pre></div> + +<p><a href="Drain.java">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 © 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/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java new file mode 100755 index 0000000..109a72b --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java @@ -0,0 +1,83 @@ +/* + * + * 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. + * + */ + +package org.apache.qpid.example; + +import java.io.InputStream; +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.naming.Context; +import javax.naming.InitialContext; + + +public class Hello +{ + + public Hello() + { + } + + public static void main(String[] args) + { + Hello hello = new Hello(); + hello.runTest(); + } + + private void runTest() + { + try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties")) + { + Properties properties = new Properties(); + properties.load(resourceAsStream); + Context context = new InitialContext(properties); + + ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("qpidConnectionfactory"); + Connection connection = connectionFactory.createConnection(); + connection.start(); + + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination destination = (Destination) context.lookup("topicExchange"); + + MessageProducer messageProducer = session.createProducer(destination); + MessageConsumer messageConsumer = session.createConsumer(destination); + + TextMessage message = session.createTextMessage("Hello world!"); + messageProducer.send(message); + + message = (TextMessage)messageConsumer.receive(); + System.out.println(message.getText()); + + connection.close(); + context.close(); + } + catch (Exception exp) + { + exp.printStackTrace(); + } + } +} http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java.html b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java.html new file mode 100644 index 0000000..777e6df --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/Hello.java.html @@ -0,0 +1,211 @@ +<!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>Hello.java - Apache Qpid™</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>™</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/broker-j/index.html">Broker-J</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-jms-amqp-0-x-6.3.2/index.html">Qpid JMS AMQP 0-x 6.3.2</a></li><li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/examples/index.html">Qpid JMS AMQP 0-x Examples</a></li><li>Hello.java</li></ul> + + <div id="-middle-content"> + +<h1>Hello.java</h1> +<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">java.io.InputStream</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">java.util.Properties</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.ConnectionFactory</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.MessageProducer</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.TextMessage</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.naming.Context</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.naming.InitialContext</span><span class="o">;</span> + + +<span class="kd">public</span> <span class="kd">class</span> <span class="nc">Hello</span> +<span class="o">{</span> + + <span class="kd">public</span> <span class="nf">Hello</span><span class="o">()</span> + <span class="o">{</span> + <span class="o">}</span> + + <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> + <span class="o">{</span> + <span class="n">Hello</span> <span class="n">hello</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Hello</span><span class="o">();</span> + <span class="n">hello</span><span class="o">.</span><span class="na">runTest</span><span class="o">();</span> + <span class="o">}</span> + + <span class="kd">private</span> <span class="kt">void</span> <span class="nf">runTest</span><span class="o">()</span> + <span class="o">{</span> + <span class="k">try</span> <span class="o">(</span><span class="n">InputStream</span> <span class="n">resourceAsStream</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="na">getClass</span><span class="o">().</span><span class="na">getResourceAsStream</span><span class="o">(</span><span class="s">"hello.properties"</span><span class="o">))</span> + <span class="o">{</span> + <span class="n">Properties</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="o">();</span> + <span class="n">properties</span><span class="o">.</span><span class="na">load</span><span class="o">(</span><span class="n">resourceAsStream</span><span class="o">);</span> + <span class="n">Context</span> <span class="n">context</span> <span class="o">=</span> <span class="k">new</span> <span class="n">InitialContext</span><span class="o">(</span><span class="n">properties</span><span class="o">);</span> + + <span class="n">ConnectionFactory</span> <span class="n">connectionFactory</span> <span class="o">=</span> <span class="o">(</span><span class="n">ConnectionFactory</span><span class="o">)</span> <span class="n">context</span><span class="o">.</span><span class="na">lookup</span><span class="o">(</span><span class="s">"qpidConnectionfactory"</span><span class="o">);</span> + <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span> <span class="n">connectionFactory</span><span class="o">.</span><span class="na">createConnection</span><span class="o">();</span> + <span class="n">connection</span><span class="o">.</span><span class="na">start</span><span class="o">();</span> + + <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span> + <span class="n">Destination</span> <span class="n">destination</span> <span class="o">=</span> <span class="o">(</span><span class="n">Destination</span><span class="o">)</span> <span class="n">context</span><span class="o">.</span><span class="na">lookup</span><span class="o">(</span><span class="s">"topicExchange"</span><span class="o">);</span> + + <span class="n">MessageProducer</span> <span class="n">messageProducer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createProducer</span><span class="o">(</span><span class="n">destination</span><span class="o">);</span> + <span class="n">MessageConsumer</span> <span class="n">messageConsumer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">destination</span><span class="o">);</span> + + <span class="n">TextMessage</span> <span class="n">message</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createTextMessage</span><span class="o">(</span><span class="s">"Hello world!"</span><span class="o">);</span> + <span class="n">messageProducer</span><span class="o">.</span><span class="na">send</span><span class="o">(</span><span class="n">message</span><span class="o">);</span> + + <span class="n">message</span> <span class="o">=</span> <span class="o">(</span><span class="n">TextMessage</span><span class="o">)</span><span class="n">messageConsumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">message</span><span class="o">.</span><span class="na">getText</span><span class="o">());</span> + + <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span> + <span class="n">context</span><span class="o">.</span><span class="na">close</span><span class="o">();</span> + <span class="o">}</span> + <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">exp</span><span class="o">)</span> + <span class="o">{</span> + <span class="n">exp</span><span class="o">.</span><span class="na">printStackTrace</span><span class="o">();</span> + <span class="o">}</span> + <span class="o">}</span> +<span class="o">}</span> +</pre></div> + +<p><a href="Hello.java">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 © 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/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java new file mode 100755 index 0000000..b12cfab --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java @@ -0,0 +1,101 @@ +/* + * + * 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. + * + */ + +package org.apache.qpid.example; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.MapMessage; +import javax.jms.StreamMessage; +import javax.jms.MessageConsumer; +import javax.jms.Session; +import javax.jms.MessageEOFException; + +import org.apache.qpid.client.AMQAnyDestination; +import org.apache.qpid.client.AMQConnection; + +import org.apache.qpid.jms.ListMessage; + +import java.util.Enumeration; +import java.util.Iterator; + +public class ListReceiver { + + public static void main(String[] args) throws Exception + { + if (args.length != 1) { + System.out.println("Usage: java org.apache.qpid.example.ListReceiver <-l | -m | -s>"); + System.out.println("where:"); + System.out.println("\t-l\tAccept ListMessage and print it"); + System.out.println("\t-m\tAccept ListMessage as a MapMessage"); + System.out.println("\t-s\tAccept ListMessage as a StreamMessage"); + return; + } + + Connection connection = + new AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'"); + + connection.start(); + + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination queue = new AMQAnyDestination("ADDR:message_queue; {create: always}"); + MessageConsumer consumer = session.createConsumer(queue); + + if (args[0].equals("-l")) { + System.out.println("Receiving as ListMessage"); + ListMessage m = (ListMessage)consumer.receive(); + System.out.println(m); + System.out.println("=========================================="); + System.out.println("Printing list contents:"); + Iterator i = m.iterator(); + while(i.hasNext()) + System.out.println(i.next()); + } + else if (args[0].equals("-m")) { + System.out.println("Receiving as MapMessage"); + MapMessage m = (MapMessage)consumer.receive(); + System.out.println(m); + System.out.println("=========================================="); + System.out.println("Printing map contents:"); + Enumeration keys = m.getMapNames(); + while(keys.hasMoreElements()) { + String key = (String)keys.nextElement(); + System.out.println(key + " => " + m.getObject(key)); + } + } + else if (args[0].equals("-s")) { + System.out.println("Receiving as StreamMessage"); + StreamMessage m = (StreamMessage)consumer.receive(); + System.out.println(m); + System.out.println("=========================================="); + System.out.println("Printing stream contents:"); + try { + while(true) + System.out.println(m.readObject()); + } + catch (MessageEOFException e) { + // DONE + } + } + + connection.close(); + } +} http://git-wip-us.apache.org/repos/asf/qpid-site/blob/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java.html ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java.html b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java.html new file mode 100644 index 0000000..a067aeb --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListReceiver.java.html @@ -0,0 +1,229 @@ +<!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>ListReceiver.java - Apache Qpid™</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>™</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/broker-j/index.html">Broker-J</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-jms-amqp-0-x-6.3.2/index.html">Qpid JMS AMQP 0-x 6.3.2</a></li><li><a href="/releases/qpid-jms-amqp-0-x-6.3.2/examples/index.html">Qpid JMS AMQP 0-x Examples</a></li><li>ListReceiver.java</li></ul> + + <div id="-middle-content"> + +<h1>ListReceiver.java</h1> +<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nn">org.apache.qpid.example</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">javax.jms.Connection</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Destination</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.MapMessage</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.StreamMessage</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.MessageConsumer</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.Session</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">javax.jms.MessageEOFException</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQAnyDestination</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">org.apache.qpid.client.AMQConnection</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">org.apache.qpid.jms.ListMessage</span><span class="o">;</span> + +<span class="kn">import</span> <span class="nn">java.util.Enumeration</span><span class="o">;</span> +<span class="kn">import</span> <span class="nn">java.util.Iterator</span><span class="o">;</span> + +<span class="kd">public</span> <span class="kd">class</span> <span class="nc">ListReceiver</span> <span class="o">{</span> + + <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> + <span class="o">{</span> + <span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">.</span><span class="na">length</span> <span class="o">!=</span> <span class="mi">1</span><span class="o">)</span> <span class="o">{</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Usage: java org.apache.qpid.example.ListReceiver <-l | -m | -s>"</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"where:"</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"\t-l\tAccept ListMessage and print it"</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"\t-m\tAccept ListMessage as a MapMessage"</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"\t-s\tAccept ListMessage as a StreamMessage"</span><span class="o">);</span> + <span class="k">return</span><span class="o">;</span> + <span class="o">}</span> + + <span class="n">Connection</span> <span class="n">connection</span> <span class="o">=</span> + <span class="k">new</span> <span class="n">AMQConnection</span><span class="o">(</span><span class="s">"amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'"</span><span class="o">);</span> + + <span class="n">connection</span><span class="o">.</span><span class="na">start</span><span class="o">();</span> + + <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="na">createSession</span><span class="o">(</span><span class="kc">false</span><span class="o">,</span> <span class="n">Session</span><span class="o">.</span><span class="na">AUTO_ACKNOWLEDGE</span><span class="o">);</span> + <span class="n">Destination</span> <span class="n">queue</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AMQAnyDestination</span><span class="o">(</span><span class="s">"ADDR:message_queue; {create: always}"</span><span class="o">);</span> + <span class="n">MessageConsumer</span> <span class="n">consumer</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="na">createConsumer</span><span class="o">(</span><span class="n">queue</span><span class="o">);</span> + + <span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">[</span><span class="mi">0</span><span class="o">].</span><span class="na">equals</span><span class="o">(</span><span class="s">"-l"</span><span class="o">))</span> <span class="o">{</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Receiving as ListMessage"</span><span class="o">);</span> + <span class="n">ListMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">ListMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"=========================================="</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Printing list contents:"</span><span class="o">);</span> + <span class="n">Iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="na">iterator</span><span class="o">();</span> + <span class="k">while</span><span class="o">(</span><span class="n">i</span><span class="o">.</span><span class="na">hasNext</span><span class="o">())</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">i</span><span class="o">.</span><span class="na">next</span><span class="o">());</span> + <span class="o">}</span> + <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">[</span><span class="mi">0</span><span class="o">].</span><span class="na">equals</span><span class="o">(</span><span class="s">"-m"</span><span class="o">))</span> <span class="o">{</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Receiving as MapMessage"</span><span class="o">);</span> + <span class="n">MapMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">MapMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"=========================================="</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Printing map contents:"</span><span class="o">);</span> + <span class="n">Enumeration</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="na">getMapNames</span><span class="o">();</span> + <span class="k">while</span><span class="o">(</span><span class="n">keys</span><span class="o">.</span><span class="na">hasMoreElements</span><span class="o">())</span> <span class="o">{</span> + <span class="n">String</span> <span class="n">key</span> <span class="o">=</span> <span class="o">(</span><span class="n">String</span><span class="o">)</span><span class="n">keys</span><span class="o">.</span><span class="na">nextElement</span><span class="o">();</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">key</span> <span class="o">+</span> <span class="s">" => "</span> <span class="o">+</span> <span class="n">m</span><span class="o">.</span><span class="na">getObject</span><span class="o">(</span><span class="n">key</span><span class="o">));</span> + <span class="o">}</span> + <span class="o">}</span> + <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">args</span><span class="o">[</span><span class="mi">0</span><span class="o">].</span><span class="na">equals</span><span class="o">(</span><span class="s">"-s"</span><span class="o">))</span> <span class="o">{</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Receiving as StreamMessage"</span><span class="o">);</span> + <span class="n">StreamMessage</span> <span class="n">m</span> <span class="o">=</span> <span class="o">(</span><span class="n">StreamMessage</span><span class="o">)</span><span class="n">consumer</span><span class="o">.</span><span class="na">receive</span><span class="o">();</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"=========================================="</span><span class="o">);</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Printing stream contents:"</span><span class="o">);</span> + <span class="k">try</span> <span class="o">{</span> + <span class="k">while</span><span class="o">(</span><span class="kc">true</span><span class="o">)</span> + <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">m</span><span class="o">.</span><span class="na">readObject</span><span class="o">());</span> + <span class="o">}</span> + <span class="k">catch</span> <span class="o">(</span><span class="n">MessageEOFException</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span> + <span class="c1">// DONE</span> + <span class="o">}</span> + <span class="o">}</span> + + <span class="n">connection</span><span class="o">.</span><span class="na">close</span><span class="o">();</span> + <span class="o">}</span> +<span class="o">}</span> +</pre></div> + +<p><a href="ListReceiver.java">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 © 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/b3a90a4a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListSender.java ---------------------------------------------------------------------- diff --git a/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListSender.java b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListSender.java new file mode 100755 index 0000000..fe2c1ec --- /dev/null +++ b/content/releases/qpid-jms-amqp-0-x-6.3.2/examples/ListSender.java @@ -0,0 +1,86 @@ +/* + * + * 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. + * + */ + +package org.apache.qpid.example; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.jms.Connection; +import javax.jms.Destination; +import javax.jms.Message; +import javax.jms.MessageProducer; +import javax.jms.Session; + +import org.apache.qpid.client.AMQAnyDestination; +import org.apache.qpid.client.AMQConnection; + +import org.apache.qpid.jms.ListMessage; + + +public class ListSender { + + public static void main(String[] args) throws Exception + { + Connection connection = + new AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'"); + + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination queue = new AMQAnyDestination("ADDR:message_queue; {create: always}"); + MessageProducer producer = session.createProducer(queue); + + ListMessage m = ((org.apache.qpid.jms.Session)session).createListMessage(); + m.setIntProperty("Id", 987654321); + m.setStringProperty("name", "Widget"); + m.setDoubleProperty("price", 0.99); + + List<String> colors = new ArrayList<String>(); + colors.add("red"); + colors.add("green"); + colors.add("white"); + m.add(colors); + + Map<String,Double> dimensions = new HashMap<String,Double>(); + dimensions.put("length",10.2); + dimensions.put("width",5.1); + dimensions.put("depth",2.0); + m.add(dimensions); + + List<List<Integer>> parts = new ArrayList<List<Integer>>(); + parts.add(Arrays.asList(new Integer[] {1,2,5})); + parts.add(Arrays.asList(new Integer[] {8,2,5})); + m.add(parts); + + Map<String,Object> specs = new HashMap<String,Object>(); + specs.put("colours", colors); + specs.put("dimensions", dimensions); + specs.put("parts", parts); + m.add(specs); + + producer.send((Message)m); + System.out.println("Sent: " + m); + connection.close(); + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
