activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r517692 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq: connector/openwire/OpenWireConnector.cpp connector/stomp/StompProducerInfo.h core/ActiveMQProducer.cpp core/ActiveMQSession.cpp
Date Tue, 13 Mar 2007 13:29:47 GMT
Author: nmittler
Date: Tue Mar 13 06:29:46 2007
New Revision: 517692

URL: http://svn.apache.org/viewvc?view=rev&rev=517692
Log:
AMQCPP-79 - adding support for producers with null destinations

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompProducerInfo.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp?view=diff&rev=517692&r1=517691&r2=517692
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/OpenWireConnector.cpp
Tue Mar 13 06:29:46 2007
@@ -687,22 +687,27 @@
         producerId->setSessionId( session->getSessionId() );
         producerId->setValue( getNextProducerId() );
 
-        // Cast the destination to an OpenWire destination, so we can
-        // get all the goodies.
-        const commands::ActiveMQDestination* amqDestination =
-            dynamic_cast<const commands::ActiveMQDestination*>(destination);
-        if( amqDestination == NULL ) {
-            throw ConnectorException( __FILE__, __LINE__,
-                "Destination was either NULL or not created by this OpenWireConnector" );
+        // Producers are allowed to have NULL destinations.  In this case, the
+        // destination is specified by the messages as they are sent.
+        if( destination != NULL ) {
+            
+            // Cast the destination to an OpenWire destination, so we can
+            // get all the goodies.
+            const commands::ActiveMQDestination* amqDestination =
+                dynamic_cast<const commands::ActiveMQDestination*>(destination);
+            if( amqDestination == NULL ) {
+                throw ConnectorException( __FILE__, __LINE__,
+                    "Destination was not created by this OpenWireConnector" );
+            }
+    
+            // Get any options specified in the destination and apply them to the
+            // ProducerInfo object.
+            producerInfo->setDestination( dynamic_cast<commands::ActiveMQDestination*>(
+                amqDestination->cloneDataStructure()) );
+            const Properties& options = amqDestination->getOptions();
+            producerInfo->setDispatchAsync( Boolean::parseBoolean(
+                options.getProperty( "producer.dispatchAsync", "false" )) );
         }
-
-        // Get any options specified in the destination and apply them to the
-        // ProducerInfo object.
-        producerInfo->setDestination( dynamic_cast<commands::ActiveMQDestination*>(
-            amqDestination->cloneDataStructure()) );
-        const Properties& options = amqDestination->getOptions();
-        producerInfo->setDispatchAsync( Boolean::parseBoolean(
-            options.getProperty( "producer.dispatchAsync", "false" )) );
 
         // Send the message to the broker.
         Response* response = syncRequest(producerInfo);

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompProducerInfo.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompProducerInfo.h?view=diff&rev=517692&r1=517691&r2=517692
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompProducerInfo.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompProducerInfo.h
Tue Mar 13 06:29:46 2007
@@ -65,7 +65,14 @@
          * @param destination reference to a destination, copied internally
          */
         virtual void setDestination( const cms::Destination* destination ) {
-            this->destination = destination->clone();
+            
+            // Delete the previous destination if it exists.
+            delete this->destination;
+            this->destination = NULL;
+            
+            if( destination != NULL ) {
+                this->destination = destination->clone();
+            }
         }
 
         /**

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp?view=diff&rev=517692&r1=517691&r2=517692
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQProducer.cpp Tue
Mar 13 06:29:46 2007
@@ -154,6 +154,13 @@
                 __FILE__, __LINE__,
                 "ActiveMQProducer::send - This Producer is closed" );
         }
+        
+        if( destination == NULL ) {
+            
+            throw InvalidStateException( 
+                __FILE__, __LINE__, 
+                "ActiveMQProducer::send - Attempting to send on NULL destination");
+        }
 
         // configure the message
         message->setCMSDestination( destination );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?view=diff&rev=517692&r1=517691&r2=517692
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Tue
Mar 13 06:29:46 2007
@@ -265,7 +265,7 @@
         {
             throw InvalidStateException(
                 __FILE__, __LINE__,
-                "ActiveMQSession::createProducer - Session Already Closed" );
+                "ActiveMQSession::createDurableConsumer - Session Already Closed" );
         }
 
         // Create the consumer instance.



Mime
View raw message