activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r394242 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp: Send.java Subscription.java
Date Sat, 15 Apr 2006 02:05:08 GMT
Author: chirino
Date: Fri Apr 14 19:05:04 2006
New Revision: 394242

URL: http://svn.apache.org/viewcvs?rev=394242&view=rev
Log:
Get bytes messages to work right with pub sub.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Subscription.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java?rev=394242&r1=394241&r2=394242&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Send.java
Fri Apr 14 19:05:04 2006
@@ -24,7 +24,6 @@
 
 import javax.jms.JMSException;
 
-import org.apache.activeio.packet.ByteSequence;
 import org.apache.activemq.command.ActiveMQBytesMessage;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQMessage;
@@ -59,8 +58,7 @@
             byte nil = in.readByte();
             if (nil != 0)
                 throw new ProtocolException("content-length bytes were read and " + "there
was no trailing null byte");
-            ByteSequence content = new ByteSequence(bytes, 0, bytes.length);
-            bm.setContent(content);
+            bm.writeBytes(bytes);
             msg = bm;
         }
         else {
@@ -125,9 +123,7 @@
             msg.setTransactionId(tx_id);
         }
         
-        msg.setReadOnlyBody(true);
-        msg.setReadOnlyProperties(true);
-
+        msg.onSend();
         return new CommandEnvelope(msg, headers);
     }
 

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Subscription.java?rev=394242&r1=394241&r2=394242&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Subscription.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Subscription.java
Fri Apr 14 19:05:04 2006
@@ -76,9 +76,10 @@
         builder.addHeaders(m);
         
         if( m.getDataStructureType() == ActiveMQTextMessage.DATA_STRUCTURE_TYPE ) {
-            builder.setBody(((ActiveMQTextMessage)m).getText().getBytes("UTF-8"));
+            ActiveMQTextMessage msg = (ActiveMQTextMessage)m.copy();
+            builder.setBody(msg.getText().getBytes("UTF-8"));
         } else if( m.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE )
{
-            ActiveMQBytesMessage msg = (ActiveMQBytesMessage)m;
+            ActiveMQBytesMessage msg = (ActiveMQBytesMessage)m.copy();
             byte[] data = new byte[(int)msg.getBodyLength()]; 
             msg.readBytes(data);
             builder.addHeader(Stomp.Headers.CONTENT_LENGTH, data.length);



Mime
View raw message