From 32d504f99479575f657fcc17842f4941ec196440 Mon Sep 17 00:00:00 2001 From: Jonathan Robie Date: Tue, 25 Jan 2011 23:31:42 +0000 Subject: Fixes several validation errors. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1063521 13f79535-47bb-0310-9956-ffa450edef68 --- doc/book/src/Programming-In-Apache-Qpid.xml | 344 ++++++++++++++-------------- 1 file changed, 174 insertions(+), 170 deletions(-) (limited to 'doc/book/src/Programming-In-Apache-Qpid.xml') diff --git a/doc/book/src/Programming-In-Apache-Qpid.xml b/doc/book/src/Programming-In-Apache-Qpid.xml index f4c82ac748..3c0c358c67 100644 --- a/doc/book/src/Programming-In-Apache-Qpid.xml +++ b/doc/book/src/Programming-In-Apache-Qpid.xml @@ -3,7 +3,7 @@ ]> @@ -29,7 +29,7 @@ Introduction - + Apache Qpid is a reliable, asynchronous messaging system that supports the AMQP messaging protocol in several common programming languages. Qpid is supported on most common platforms. @@ -40,7 +40,7 @@ On the Java platform, Qpid uses the established Java JMS - API. + API. @@ -50,7 +50,7 @@ conceptually similar in each. - On the .NET platform, Qpid also provides a WCF binding. + On the .NET platform, Qpid also provides a WCF binding. @@ -82,14 +82,14 @@ message). - + A connection represents a network connection to a remote endpoint. - + A session provides a sequentially @@ -98,7 +98,7 @@ connection. - + A sender sends messages to a target @@ -106,7 +106,7 @@ obtained from a session for a given target address. - + A receiver receives messages from a @@ -115,7 +115,7 @@ address. - + @@ -147,7 +147,7 @@ int main(int argc, char** argv) { std::string broker = argc > 1 ? argv[1] : "localhost:5672"; std::string address = argc > 2 ? argv[2] : "amq.topic"; std::string connectionOptions = argc > 3 ? argv[3] : ""; - + Connection connection(broker, connectionOptions); try { connection.open(); @@ -161,13 +161,13 @@ int main(int argc, char** argv) { Message message = receiver.fetch(Duration::SECOND * 1); session.acknowledge(); - + connection.close(); return 0; } catch(const std::exception& error) { connection.close(); - return 1; + return 1; } } @@ -274,7 +274,7 @@ finally:
A Simple Messaging Program in .NET C# - The following .NET C# + The following .NET C# The .NET binding for the Qpid C++ Messaging API @@ -367,15 +367,15 @@ namespace Org.Apache.Qpid.Messaging {
Addresses - + An address is the name of a message - target or message source. + target or message source. In the programs we have just seen, we used amq.topic as the default address if none is passed in. This is the name of a standard exchange that always exists on an AMQP 0-10 messaging broker. - + The methods that create senders and receivers require an address. The details of sending to a particular target or receiving from a particular source are then handled by the @@ -408,7 +408,7 @@ namespace Org.Apache.Qpid.Messaging { A topic immediately delivers a message to all eligible receivers; if there are no eligible receivers, it discards the message. In the AMQP 0-10 implementation of the API, - + The AMQP 0-10 implementation is the only one that currently exists. @@ -435,7 +435,7 @@ namespace Org.Apache.Qpid.Messaging { language. These programs can use any address string as a source or a destination, and have many command line options to configure behavior—use the -h option - for documentation on these options. + for documentation on these options. Currently, the C++, Python, and .NET C# implementations of drain and @@ -518,7 +518,7 @@ $ $ ./drain -t 30 hello-word - + Second Window: @@ -548,14 +548,14 @@ Message(properties={spout-id:7da2d27d-93e6-4803-8a61-536d87b8d93f:0}, content='' string can also contain a subject and options. - + The syntax for an address string is: - + [ / ] [ ; ] options ::= { : , ... } ]]> - + Addresses, subjects, and keys are strings. Values can be numbers, strings (with optional single or double quotes), maps, or lists. A complete BNF for address strings appears in @@ -578,7 +578,7 @@ options ::= { : , ... } message's subject is null. For convenience, address strings also allow a subject. If a sender's address contains a subject, it is used as the default subject for the messages - it sends. + it sends. If a receiver's address contains a subject, it is used to select only messages that match the subject—the matching @@ -639,7 +639,7 @@ Message(properties={qpid.subject:sports, spout-id:9441674e-a157-4780-a78e-f7ccea drain receive the messages for that subject. - + The AMQP exchange type we are using here, amq.topic, can also do more sophisticated @@ -650,11 +650,11 @@ Message(properties={qpid.subject:sports, spout-id:9441674e-a157-4780-a78e-f7ccea application, the sender might use subjects like usa.news, usa.weather, europe.news, or - europe.weather. + europe.weather. The receiver's subject can include wildcard characters— # matches one or more words in the message's - subject, * matches a single word. + subject, * matches a single word. For instance, if the subject in the source address is *.news, it matches messages with the @@ -676,7 +676,7 @@ Message(properties={qpid.subject:sports, spout-id:9441674e-a157-4780-a78e-f7ccea news. First Window: - + $ ./drain -t 30 news-service/*.news @@ -767,7 +767,7 @@ Message(properties={qpid.subject:usa.faux.news, spout-id:6029430a-cfcb-4700-8e9b Policies for automatically creating or deleting the node to which an address refers. - For instance, in the address string xoxox ; {create: always}, + For instance, in the address string xoxox ; {create: always}, the queue xoxox is created, if it does not exist, before the address is resolved. @@ -801,7 +801,7 @@ Message(properties={qpid.subject:usa.faux.news, spout-id:6029430a-cfcb-4700-8e9b address string options affect the behavior of senders and receives. - +
assert @@ -821,7 +821,7 @@ Message(properties={qpid.subject:usa.faux.news, spout-id:6029430a-cfcb-4700-8e9b $ qpid-config add queue my-queue $ qpid-config add exchange topic my-topic - + We can now use the address specified to drain to assert that it is of a particular type: @@ -839,7 +839,7 @@ Exchange my-queue does not exist queue. The second attempt however failed; my-queue is not a topic. - + We can do the same thing for my-topic: @@ -877,7 +877,7 @@ Queue my-topic does not exist Second Window: $ ./spout "xoxox ; {create: always}" - + Returning to the first window, we see that drain has received this message: Message(properties={spout-id:1a1a3842-1a8b-4f88-8940-b4096e615a7d:0}, content='') @@ -906,7 +906,7 @@ $ ./spout my-queue --content one $ ./spout my-queue --content two $ ./spout my-queue --content three - + Now we use drain to get those messages, using the browse option: $ ./drain 'my-queue; {mode: browse}' @@ -914,7 +914,7 @@ Message(properties={spout-id:fbb93f30-0e82-4b6d-8c1d-be60eb132530:0}, content='o Message(properties={spout-id:ab9e7c31-19b0-4455-8976-34abe83edc5f:0}, content='two') Message(properties={spout-id:ea75d64d-ea37-47f9-96a9-d38e01c97925:0}, content='three') - + We can confirm the messages are still on the queue by repeating the drain: $ ./drain 'my-queue; {mode: browse}' @@ -960,9 +960,9 @@ $ qpid-config add exchange xml xml @@ -978,8 +978,8 @@ xml; { 50 and $w/temperature_f - $w/dewpoint > 5 and $w/wind_speed_mph > 7 @@ -989,9 +989,9 @@ return $w/station = 'Raleigh-Durham International Airport (KRDU)' We can specify this query in an x-binding to listen to messages that meet the criteria specified by the query: First Window: - + -$ ./drain -f "xml; {link:{x-bindings:[{key:'weather', +$ ./drain -f "xml; {link:{x-bindings:[{key:'weather', arguments:{xquery:\"$(cat rdu.xquery )\"}}]}}" @@ -1015,9 +1015,9 @@ spout --content "$(cat rdu.xml)" xml/weather Returning to the first window, we see that the message has been received: - + Raleigh-Durham International Airport (KRDU) 16 @@ -1172,7 +1172,7 @@ spout - -content "$(cat rdu.xml | sed -e 's/70/45/')" xml/weather durable - + True, False @@ -1212,9 +1212,9 @@ spout - -content "$(cat rdu.xml | sed -e 's/70/45/')" xml/weather exchange: , queue: , key: , - arguments: { - : , - ..., + arguments: { + : , + ..., : } }, ... @@ -1277,7 +1277,7 @@ spout - -content "$(cat rdu.xml | sed -e 's/70/45/')" xml/weather durable - + True, False @@ -1514,7 +1514,7 @@ options := map
- +
Receiving Messages from Multiple Sources @@ -1602,20 +1602,20 @@ Session session = connection.createTransactionalSession(); ... if (smellsOk()) session.commit(); -else +else session.rollback(); ]]> .NET C#: - + Connection connection = new Connection(broker); Session session = connection.CreateTransactionalSession(); ... if (smellsOk()) session.Commit(); -else +else session.Rollback();