activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r771762 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/wireformat/stomp/ main/activemq/wireformat/stomp/marshal/ test-integration/activemq/util/
Date Tue, 05 May 2009 14:54:26 GMT
Author: tabish
Date: Tue May  5 14:54:26 2009
New Revision: 771762

URL: http://svn.apache.org/viewvc?rev=771762&view=rev
Log:
More Stomp updates related to Unsubscribing a durable consumer.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.cpp?rev=771762&r1=771761&r2=771762&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.cpp
Tue May  5 14:54:26 2009
@@ -69,7 +69,8 @@
 const std::string StompCommandConstants::HEADER_JMSPRIORITY = "priority";
 const std::string StompCommandConstants::HEADER_CONSUMERPRIORITY = "activemq.priority";
 const std::string StompCommandConstants::HEADER_RETROACTIVE = "activemq.retroactive";
-const std::string StompCommandConstants::HEADER_SUBSCRIPTIONNAME = "activemq.subcriptionName";
+const std::string StompCommandConstants::HEADER_SUBSCRIPTIONNAME = "activemq.subscriptionName";
+const std::string StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME = "activemq.subcriptionName";
 const std::string StompCommandConstants::HEADER_TIMESTAMP = "timestamp";
 const std::string StompCommandConstants::HEADER_REDELIVERED = "redelivered";
 const std::string StompCommandConstants::HEADER_REDELIVERYCOUNT = "redelivery_count";

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.h?rev=771762&r1=771761&r2=771762&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/StompCommandConstants.h
Tue May  5 14:54:26 2009
@@ -75,6 +75,7 @@
         static const std::string HEADER_CONSUMERPRIORITY;
         static const std::string HEADER_RETROACTIVE;
         static const std::string HEADER_SUBSCRIPTIONNAME;
+        static const std::string HEADER_OLDSUBSCRIPTIONNAME;
         static const std::string HEADER_TIMESTAMP;
         static const std::string HEADER_REDELIVERED;
         static const std::string HEADER_REDELIVERYCOUNT;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp?rev=771762&r1=771761&r2=771762&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/stomp/marshal/Marshaler.cpp
Tue May  5 14:54:26 2009
@@ -189,18 +189,30 @@
 ////////////////////////////////////////////////////////////////////////////////
 Pointer<Command> Marshaler::unmarshalError( const Pointer<StompFrame>& frame
) {
 
-    Pointer<Command> result;
-
     Pointer<BrokerError> error( new BrokerError() );
     error->setMessage(
         frame->removeProperty( StompCommandConstants::HEADER_MESSAGE ) );
 
     if( frame->hasProperty( StompCommandConstants::HEADER_RECEIPTID ) ) {
-        Pointer<ExceptionResponse> errorResponse( new ExceptionResponse() );
-        errorResponse->setException( error );
-        errorResponse->setCorrelationId( Integer::parseInt(
-            frame->removeProperty( StompCommandConstants::HEADER_RECEIPTID ) ) );
-        return errorResponse;
+
+        std::string responseId = frame->removeProperty( StompCommandConstants::HEADER_RECEIPTID
);
+
+        // If we indicated that we don't care if the request failed then just create a
+        // response command to answer the request.
+        if( responseId.find( "ignore:" ) != std::string::npos ) {
+
+            Pointer<Response> response( new Response() );
+            response->setCorrelationId( Integer::parseInt( responseId.substr( 7 ) ) );
+            return response;
+
+        } else {
+
+            Pointer<ExceptionResponse> errorResponse( new ExceptionResponse() );
+            errorResponse->setException( error );
+            errorResponse->setCorrelationId( Integer::parseInt( responseId ) );
+            return errorResponse;
+        }
+
     } else {
         return error;
     }
@@ -371,6 +383,9 @@
     if( info->getSubscriptionName() != "" ) {
         frame->setProperty( StompCommandConstants::HEADER_SUBSCRIPTIONNAME,
                             info->getSubscriptionName() );
+        // Older Brokers had an misspelled property name, this ensure we can talk to them
as well.
+        frame->setProperty( StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME,
+                            info->getSubscriptionName() );
     }
 
     if( info->getSelector() != "" ) {
@@ -408,20 +423,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 Pointer<StompFrame> Marshaler::marshalRemoveSubscriptionInfo( const Pointer<Command>&
command ) {
 
-    std::cout << "Marshalling a RemoveSubscriptionInfo command" << std::endl;
-
     Pointer<RemoveSubscriptionInfo> info = command.dynamicCast<RemoveSubscriptionInfo>();
     Pointer<StompFrame> frame( new StompFrame() );
     frame->setCommand( StompCommandConstants::UNSUBSCRIBE );
 
     if( command->isResponseRequired() ) {
         frame->setProperty( StompCommandConstants::HEADER_RECEIPT_REQUIRED,
-                            Integer::toString( command->getCommandId() ) );
+                            std::string( "ignore:" ) + Integer::toString( command->getCommandId()
) );
     }
 
     frame->setProperty( StompCommandConstants::HEADER_ID, info->getClientId() );
     frame->setProperty( StompCommandConstants::HEADER_SUBSCRIPTIONNAME,
                         info->getSubcriptionName() );
 
+    // Older Brokers had an misspelled property name, this ensure we can talk to them as
well.
+    frame->setProperty( StompCommandConstants::HEADER_OLDSUBSCRIPTIONNAME,
+                        info->getSubcriptionName() );
+
     return frame;
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp?rev=771762&r1=771761&r2=771762&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/util/CMSProvider.cpp
Tue May  5 14:54:26 2009
@@ -191,11 +191,8 @@
         }
 
         if( this->consumer.get() && this->durable && this->topic
) {
-
-            if( this->brokerURL.find_first_of( "stomp", 0 ) == string::npos ) {
-                this->consumer->close();
-                this->session->unsubscribe( this->subscription );
-            }
+             this->consumer->close();
+             this->session->unsubscribe( this->subscription );
         }
     }
     AMQ_CATCH_RETHROW( activemq::exceptions::ActiveMQException )



Mime
View raw message