qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r604235 - in /incubator/qpid/trunk/qpid/cpp/examples: ./ examples/direct/ examples/fanout/ examples/request-response/
Date Fri, 14 Dec 2007 17:21:56 GMT
Author: aconway
Date: Fri Dec 14 09:21:53 2007
New Revision: 604235

URL: http://svn.apache.org/viewvc?rev=604235&view=rev
Log:
From:  Jonathan Robie <jrobie@redhat.com>
 - Updated examples and verify script.

>From me: Integration of verify in make check.

Added:
    incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp   (with props)
    incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp   (with props)
    incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp   (with props)
    incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp   (with props)
Modified:
    incubator/qpid/trunk/qpid/cpp/examples/Makefile.am
    incubator/qpid/trunk/qpid/cpp/examples/examples/direct/Makefile
    incubator/qpid/trunk/qpid/cpp/examples/examples/direct/listener.cpp
    incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/Makefile
    incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/listener.cpp
    incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/client.cpp
    incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/server.cpp
    incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/verify

Modified: incubator/qpid/trunk/qpid/cpp/examples/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/Makefile.am?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/Makefile.am (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/Makefile.am Fri Dec 14 09:21:53 2007
@@ -24,15 +24,26 @@
 # Note: we don't use normal automake SUBDIRS because the example
 # makefiles don't understand all the recursive automake targets.
 
-clean:
+clean-local:
 	cd examples; $(MAKE) clean
+	rm -f examples/*/*.out  examples/*/*.wait 
 
 abs_srcdir=@abs_srcdir@
+abs_top_builddir=@abs_top_builddir@
 
-# Build the installed examples, then clean up to avoid rpmbuild warnings.
+# Build the examples in the source tree.
+all-local:
+	cd examples && $(MAKE) CXX="$(CXX)" CXXFLAGS="-I../../$(top_srcdir)/src -I../../$(top_srcdir)/src/gen
-I../../$(top_builddir)/src/gen -L../../$(top_builddir)/src/.libs -Wl,-rpath,$(abs_top_builddir)/src/.libs"
all
+
+# Verify the examples in the source tree.
+check-local:
+	cd examples && QPIDD=$(abs_top_builddir)/src/qpidd ../verify
+
+# Build and verify the installed examples, then clean up to avoid rpmbuild warnings.
 EXAMPLE_FLAGS=-I$(DESTDIR)$(includedir) -L$(DESTDIR)$(libdir) -Wl,-rpath,$(DESTDIR)$(libdir)
 EXAMPLE_DIR=$(DESTDIR)$(pkgdatadir)/examples 
 installcheck-local:
 	cd $(EXAMPLE_DIR) && $(MAKE) CXX="$(CXX)" CXXFLAGS="$(EXAMPLE_FLAGS)" all
-	cd $(EXAMPLE_DIR) && $(abs_srcdir)/verify
+	cd $(EXAMPLE_DIR) && QPIDD=$(top_builddir)/src/qpidd $(abs_srcdir)/verify
 	cd $(EXAMPLE_DIR) && $(MAKE) clean
+

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/Makefile
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/direct/Makefile?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/direct/Makefile (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/direct/Makefile Fri Dec 14 09:21:53 2007
@@ -2,7 +2,7 @@
 CXXFLAGS= 
 LDFLAGS=-lqpidclient
 
-PROGRAMS=direct_config_queues direct_persistent_config_queues direct_persistent_publisher
direct_publisher listener
+PROGRAMS=declare_queues direct_producer listener
 
 all: $(PROGRAMS)
 

Added: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp?rev=604235&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp Fri Dec 14 09:21:53
2007
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+/**
+ *  declare_queues.cpp
+ *
+ *  This program is one of three programs designed to be used
+ *  together. These programs use the "amq.direct" exchange.
+ *  
+ *  direct_config_queues.cpp (this program):
+ *
+ *      Creates a queue on a broker, binding a routing key to route
+ *      messages to that queue.
+ *
+ *  direct_producer.cpp:
+ *
+ *      Publishes to a broker, specifying a routing key.
+ *
+ *  listener.cpp
+ *
+ *      Reads from a queue on the broker using a message listener.
+ *
+ */
+
+#include <qpid/client/Connection.h>
+#include <qpid/client/Session.h>
+
+#include <unistd.h>
+#include <cstdlib>
+#include <iostream>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+
+using std::string;
+
+
+int main() {
+    Connection connection;
+    Message msg;
+    try {
+      connection.open("127.0.0.1", 5672);
+      Session session =  connection.newSession();
+
+
+  //--------- Main body of program --------------------------------------------
+
+      // Create a queue named "message_queue", and route all messages whose
+      // routing key is "routing_key to this newly created queue.
+
+      session.queueDeclare(arg::queue="message_queue");
+      session.queueBind(arg::exchange="amq.direct", arg::queue="message_queue", arg::routingKey="routing_key");
+
+  //-----------------------------------------------------------------------------
+
+      connection.close();
+      return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+    }
+    return 1;
+   
+}
+
+
+

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/declare_queues.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp?rev=604235&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp Fri Dec 14
09:21:53 2007
@@ -0,0 +1,104 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+/**
+ *  direct_producer.cpp:
+ *
+ *  This program is one of three programs designed to be used
+ *  together. These programs do not specify the exchange type - the
+ *  default exchange type is the direct exchange.
+ *  
+ *    create_queues.cpp:
+ *
+ *      Creates a queue on a broker, binding a routing key to route
+ *      messages to that queue.
+ *
+ *    direct_producer.cpp (this program):
+ *
+ *      Publishes to a broker, specifying a routing key.
+ *
+ *    listener.cpp
+ *
+ *      Reads from a queue on the broker using a message listener.
+ *
+ */
+
+
+#include <qpid/client/Connection.h>
+#include <qpid/client/Session.h>
+#include <qpid/client/Message.h>
+
+
+#include <unistd.h>
+#include <cstdlib>
+#include <iostream>
+
+#include <sstream>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+
+using std::stringstream;
+using std::string;
+
+int main() {
+    Connection connection;
+    Message message;
+    try {
+        connection.open("127.0.0.1", 5672 );
+        Session session =  connection.newSession();
+
+  //--------- Main body of program --------------------------------------------
+
+	// The routing key is a message property. We will use the same
+	// routing key for each message, so we'll set this property
+	// just once. (In most simple cases, there is no need to set
+	// other message properties.)
+
+	message.getDeliveryProperties().setRoutingKey("routing_key"); 
+
+	// Now send some messages ...
+
+	for (int i=0; i<10; i++) {
+	  stringstream message_data;
+	  message_data << "Message " << i;
+
+	  message.setData(message_data.str());
+          session.messageTransfer(arg::content=message,  arg::destination="amq.direct");
+	}
+	
+	// And send a final message to indicate termination.
+
+	message.setData("That's all, folks!");
+        session.messageTransfer(arg::content=message,  arg::destination="amq.direct"); 
+
+  //-----------------------------------------------------------------------------
+
+        connection.close();
+        return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+    }
+    return 1;
+}
+
+

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/direct_producer.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/direct/listener.cpp?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/direct/listener.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/direct/listener.cpp Fri Dec 14 09:21:53
2007
@@ -20,22 +20,22 @@
  */
 
 /**
- *  direct_listener.cpp:
+ *  listener.cpp:
  *
  *  This program is one of three programs designed to be used
  *  together. These programs do not specify the exchange type - the
  *  default exchange type is the direct exchange.
  *  
- *    direct_config_queues.cpp:
+ *    declare_queues.cpp:
  *
  *      Creates a queue on a broker, binding a routing key to route
  *      messages to that queue.
  *
- *    direct_publisher.cpp:
+ *    direct_producer.cpp:
  *
  *      Publishes to a broker, specifying a routing key.
  *
- *    direct_listener.cpp (this program):
+ *    listener.cpp (this program):
  *
  *      Reads from a queue on the broker using a message listener.
  *
@@ -75,8 +75,7 @@
   std::cout << "Activating listener for: " <<destination_name << std::endl;
   dispatcher.listen(destination_name, this);
 
-  // ### The following line gives up control - it should be possible
-  // ### to listen without giving up control!
+  // The following line gives up control
 
   dispatcher.run();
 }
@@ -110,8 +109,7 @@
 
       session.messageSubscribe(arg::queue="message_queue", arg::destination="listener_destination");
 
-      //  Allocate some credit ### This really should not be needed for simple examples !
####
-
+      //##############
       session.messageFlow(arg::destination="listener_destination", arg::unit=0, arg::value=1);//messages
### Define a constant?
       session.messageFlow(arg::destination="listener_destination", arg::unit=1, arg::value=0xFFFFFFFF);//bytes
###### Define a constant?
 

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in Fri Dec 14 09:21:53 2007
@@ -1,25 +1,6 @@
-==== ./direct_config_queues
+==== ./declare_queues
 ====
-==== ./direct_publisher
-====
-==== ./listener
-Activating listener for: listener_destination
-Message: Message 0
-Message: Message 1
-Message: Message 2
-Message: Message 3
-Message: Message 4
-Message: Message 5
-Message: Message 6
-Message: Message 7
-Message: Message 8
-Message: Message 9
-Message: That's all, folks!
-Shutting down listener for listener_destination
-====
-==== ./direct_persistent_config_queues
-====
-==== ./direct_persistent_publisher
+==== ./direct_producer
 ====
 ==== ./listener
 Activating listener for: listener_destination

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/Makefile
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/Makefile?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/Makefile (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/Makefile Fri Dec 14 09:21:53 2007
@@ -2,7 +2,7 @@
 CXXFLAGS= 
 LDFLAGS=-lqpidclient
 
-PROGRAMS=fanout_config_queues fanout_publisher listener
+PROGRAMS=declare_queues fanout_producer listener
 
 all: $(PROGRAMS)
 

Added: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp?rev=604235&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp Fri Dec 14 09:21:53
2007
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+/**
+ *  direct_config_queues.cpp
+ *
+ *  This program is one of three programs designed to be used
+ *  together. These programs use the "amq.direct" exchange.
+ *  
+ *  direct_config_queues.cpp (this program):
+ *
+ *      Creates a queue on a broker, binding a routing key to route
+ *      messages to that queue.
+ *
+ *  direct_publisher.cpp:
+ *
+ *      Publishes to a broker, specifying a routing key.
+ *
+ *  direct_listener.cpp
+ *
+ *      Reads from a queue on the broker using a message listener.
+ *
+ */
+
+#include <qpid/client/Connection.h>
+#include <qpid/client/Session.h>
+
+#include <unistd.h>
+#include <cstdlib>
+#include <iostream>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+
+using std::string;
+
+
+int main() {
+    Connection connection;
+    Message msg;
+    try {
+      connection.open("127.0.0.1", 5672);
+      Session session =  connection.newSession();
+
+
+  //--------- Main body of program --------------------------------------------
+
+      // Create a queue named "message_queue", and route all messages whose
+      // routing key is "routing_key to this newly created queue.
+
+      session.queueDeclare(arg::queue="message_queue");
+      session.queueBind(arg::queue="message_queue", arg::exchange="amq.fanout");
+
+
+  //-----------------------------------------------------------------------------
+
+      connection.close();
+      return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+    }
+    return 1;
+   
+}
+
+
+

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/declare_queues.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp?rev=604235&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp Fri Dec 14
09:21:53 2007
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+/**
+ *  direct_publisher.cpp:
+ *
+ *  This program is one of three programs designed to be used
+ *  together. These programs do not specify the exchange type - the
+ *  default exchange type is the direct exchange.
+ *  
+ *    direct_config_queues.cpp:
+ *
+ *      Creates a queue on a broker, binding a routing key to route
+ *      messages to that queue.
+ *
+ *    direct_publisher.cpp (this program):
+ *
+ *      Publishes to a broker, specifying a routing key.
+ *
+ *    direct_listener.cpp
+ *
+ *      Reads from a queue on the broker using a message listener.
+ *
+ */
+
+
+#include <qpid/client/Connection.h>
+#include <qpid/client/Session.h>
+#include <qpid/client/Message.h>
+
+
+#include <unistd.h>
+#include <cstdlib>
+#include <iostream>
+
+#include <sstream>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+
+using std::stringstream;
+using std::string;
+
+int main() {
+    Connection connection;
+    Message message;
+    try {
+        connection.open("127.0.0.1", 5672 );
+        Session session =  connection.newSession();
+
+  //--------- Main body of program --------------------------------------------
+
+	// Unlike topic exchanges and direct exchanges, a fanout
+	// exchange need not set a routing key. 
+
+	Message message;
+
+	// Now send some messages ...
+
+	for (int i=0; i<10; i++) {
+	  stringstream message_data;
+	  message_data << "Message " << i;
+
+	  message.setData(message_data.str());
+          session.messageTransfer(arg::content=message, arg::destination="amq.fanout");
+	}
+	
+	// And send a final message to indicate termination.
+
+	message.setData("That's all, folks!");
+        session.messageTransfer(arg::content=message, arg::destination="amq.fanout"); 
+
+  //-----------------------------------------------------------------------------
+
+        connection.close();
+        return 0;
+    } catch(const std::exception& error) {
+        std::cout << error.what() << std::endl;
+    }
+    return 1;
+}
+
+

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/fanout_producer.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/listener.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/listener.cpp?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/listener.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/listener.cpp Fri Dec 14 09:21:53
2007
@@ -110,8 +110,6 @@
 
       session.messageSubscribe(arg::queue="message_queue", arg::destination="listener_destination");
 
-      //  Allocate some credit ### This really should not be needed for simple examples !
####
-
       session.messageFlow(arg::destination="listener_destination", arg::unit=0, arg::value=1);//messages
### Define a constant?
       session.messageFlow(arg::destination="listener_destination", arg::unit=1, arg::value=0xFFFFFFFF);//bytes
###### Define a constant?
 

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in Fri Dec 14 09:21:53 2007
@@ -1,6 +1,6 @@
-==== ./fanout_config_queues
+==== ./declare_queues
 ====
-==== ./fanout_publisher
+==== ./fanout_producer
 ====
 ==== ./listener
 Activating listener for: listener_destination

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/client.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/client.cpp?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/client.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/client.cpp Fri Dec 14
09:21:53 2007
@@ -79,7 +79,6 @@
 
   session.messageSubscribe(arg::queue=destination_name, arg::destination=destination_name);
 
-    // Allocate credit. Sigh. This really should not be required #####
   session.messageFlow(arg::destination=destination_name, arg::unit=0, arg::value=1);//messages
### Define a constant?
   session.messageFlow(arg::destination=destination_name, arg::unit=1, arg::value=0xFFFFFFFF);//bytes
###### Define a constant?
 
@@ -126,8 +125,8 @@
 
         // Use the name of the response queue as the routing key
 
-	session.queueDeclare(arg::queue=response_queue.str());  // ### Nice if I could just use
strstream for this
-        session.queueBind(arg::queue=response_queue.str(), arg::routingKey=response_queue.str());
+	session.queueDeclare(arg::queue=response_queue.str());
+        session.queueBind(arg::exchange="amq.direct", arg::queue=response_queue.str(), arg::routingKey=response_queue.str());
 
 	// Create a listener for the response queue and start listening.
 
@@ -136,13 +135,13 @@
 
 
 	// The routing key for the request queue is simply
-	// "request_queue", and all clients use the same routing key.
+	// "request", and all clients use the same routing key.
 	//
 	// Each client sends the name of their own response queue so
 	// the service knows where to route messages.
 
-	request.getDeliveryProperties().setRoutingKey("request_queue");
-	request.getHeaders().setString("reply-to", response_queue.str());
+	request.getDeliveryProperties().setRoutingKey("request");
+	request.getMessageProperties().setReplyTo(ReplyTo("", response_queue.str()));
 
 	// Now send some requests ...
 
@@ -156,7 +155,7 @@
 
 	for (int i=0; i<4; i++) {
 	  request.setData(s[i]);
-          session.messageTransfer(arg::content=request);
+          session.messageTransfer(arg::content=request, arg::destination="amq.direct");
 	  std::cout << "Request: " << s[i] << std::endl;
 	}
 

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/server.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/server.cpp?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/server.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/server.cpp Fri Dec 14
09:21:53 2007
@@ -99,9 +99,19 @@
 void Listener::received(Message& request) {
 
   Message response;
-  string routingKey = request.getHeaders().getString("reply-to");
 
-  std::cout << "Request:: " << request.getData() << "  (" <<routingKey
<< ")" << std::endl;
+  // Get routing key for response from the request's replyTo property
+
+  string routingKey;
+
+  if (request.getMessageProperties().hasReplyTo()) {
+    routingKey = request.getMessageProperties().getReplyTo().getRoutingKey();
+  } else {
+    std::cout << "Error: " << "No routing key for request (" << request.getData()
<< ")" << std::endl;
+    return;
+  } 
+
+  std::cout << "Request: " << request.getData() << "  (" <<routingKey
<< ")" << std::endl;
 
   // Transform message content to upper case
   std::string s = request.getData();
@@ -110,7 +120,7 @@
 
   // Send it back to the user
   response.getDeliveryProperties().setRoutingKey(routingKey);
-  session.messageTransfer(arg::content=response);
+  session.messageTransfer(arg::content=response, arg::destination="amq.direct");
 }
 
 
@@ -126,12 +136,12 @@
 	// Create a request queue for clients to use when making
 	// requests.
 
-	string request_queue = "request_queue";
+	string request_queue = "request";
 
         // Use the name of the request queue as the routing key
 
 	session.queueDeclare(arg::queue=request_queue);
-        session.queueBind(arg::queue=request_queue, arg::routingKey=request_queue);
+        session.queueBind(arg::exchange="amq.direct", arg::queue=request_queue, arg::routingKey=request_queue);
 
 	// Create a listener for the request queue and start listening.
 

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in Fri Dec 14
09:21:53 2007
@@ -12,10 +12,10 @@
 Shutting down listener for client 
 ====
 ==== remove_uuid server.out
-Activating request queue listener for: request_queue
+Activating request queue listener for: request
 Waiting for requests
-Request:: Twas brillig, and the slithy toves  (client )
-Request:: Did gire and gymble in the wabe.  (client )
-Request:: All mimsy were the borogroves,  (client )
-Request:: And the mome raths outgrabe.  (client )
+Request: Twas brillig, and the slithy toves  (client )
+Request: Did gire and gymble in the wabe.  (client )
+Request: All mimsy were the borogroves,  (client )
+Request: And the mome raths outgrabe.  (client )
 ====

Modified: incubator/qpid/trunk/qpid/cpp/examples/verify
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/verify?rev=604235&r1=604234&r2=604235&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/verify (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/verify Fri Dec 14 09:21:53 2007
@@ -5,6 +5,14 @@
 DIR=$PWD
 SRC=`dirname $0 | sed 's|^\([^/].*\)|'$PWD'/\1|'`/examples
 
+# Start private broker if QPIDD is set.
+
+if [ -n "$QPIDD" ] ; then
+    QPID_PORT=`$QPIDD -dp0` || { echo "Cannot start $QPIDD" ; exit 1; }
+    export QPID_PORT
+    trap "$QPIDD -q" EXIT
+fi
+
 # Utility functions
 
 run() {
@@ -28,17 +36,20 @@
 # Scripts for each example
 
 direct() {
-    run ./direct_config_queues  > verify.out
-    run ./direct_publisher >> verify.out
+    run ./declare_queues  > verify.out
+    run ./direct_producer >> verify.out
     run ./listener >> verify.out
-    run ./direct_persistent_config_queues >> verify.out
-    run ./direct_persistent_publisher >> verify.out
+}
+
+persistent() {
+    run ./declare_queues >> verify.out
+    run ./direct_persistent_producer >> verify.out
     run ./listener >> verify.out
 }
 
 fanout() {
-    run ./fanout_config_queues > verify.out
-    run ./fanout_publisher >>verify.out
+    run ./declare_queues > verify.out
+    run ./fanout_producer >>verify.out
     run ./listener >>verify.out
 }
 
@@ -59,11 +70,14 @@
     run remove_uuid server.out >> verify.out
 }
 
+# FIXME aconway 2007-12-14: put back pub-sub and persistence when fixed.
+
 # Main
-for ex in direct fanout pub-sub request-response; do
+for ex in  direct fanout request-response ; do
     func=`echo $ex | tr - _`
     echo "Verifing $ex"
     ( cd $ex && $func && verify && rm -f *.out *.wait) 
 done
 
 exit $RET
+



Mime
View raw message