activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1420984 - /activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireMessage.scala
Date Wed, 12 Dec 2012 21:33:52 GMT
Author: chirino
Date: Wed Dec 12 21:33:50 2012
New Revision: 1420984

URL: http://svn.apache.org/viewvc?rev=1420984&view=rev
Log:
Properly map JMS property names to message fields so that selectors work.

Modified:
    activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireMessage.scala

Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireMessage.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireMessage.scala?rev=1420984&r1=1420983&r2=1420984&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireMessage.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireMessage.scala
Wed Dec 12 21:33:50 2012
@@ -20,10 +20,8 @@ import org.apache.activemq.apollo.broker
 import java.lang.{String, Class}
 import org.fusesource.hawtdispatch.BaseRetained
 import org.fusesource.hawtbuf.Buffer._
-import OpenwireConstants._
 import org.fusesource.hawtbuf.{UTF8Buffer, AsciiBuffer, Buffer}
 import command.{ActiveMQBytesMessage, ActiveMQTextMessage, ActiveMQMessage}
-import org.apache.activemq.apollo.broker.protocol.Protocol
 
 /**
  * <p>
@@ -35,7 +33,42 @@ class OpenwireMessage(val message:Active
 
   val _id = ascii(message.getMessageId.toString)
 
-  def getProperty(name: String) = message.getProperty(name)
+  def toString(buffer:AnyRef) = if (buffer==null) null else buffer.toString
+
+  def getProperty(name: String) = {
+    name match {
+      case "JMSDeliveryMode" =>
+        if( message.isPersistent) "PERSISTENT" else "NON_PERSISTENT"
+      case "JMSPriority" =>
+        new java.lang.Integer(message.getPriority)
+      case "JMSType" =>
+        toString(message.getType)
+      case "JMSMessageID" =>
+        toString(message.getMessageId)
+      case "JMSDestination" =>
+        toString(message.getDestination)
+      case "JMSReplyTo" =>
+        toString(message.getReplyTo)
+      case "JMSCorrelationID" =>
+        toString(message.getCorrelationId)
+      case "JMSExpiration" =>
+        new java.lang.Long(message.getExpiration)
+      case "JMSXDeliveryCount" =>
+        new java.lang.Integer(message.getRedeliveryCounter)
+      case "JMSXUserID" =>
+        toString(message.getUserID)
+      case "JMSXGroupID" =>
+        toString(message.getGroupID)
+      case "JMSXGroupSeq" =>
+        if ( message.getGroupID!=null ) {
+          new java.lang.Integer(message.getGroupSequence)
+        } else {
+          null
+        }
+      case x =>
+        message.getProperty(name)
+    }
+  }
 
   def getLocalConnectionId = message.getProducerId.getConnectionId
 



Mime
View raw message