incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r885267 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
Date Sun, 29 Nov 2009 21:17:04 GMT
Author: vdichev
Date: Sun Nov 29 21:17:02 2009
New Revision: 885267

URL: http://svn.apache.org/viewvc?rev=885267&view=rev
Log:
ESME-101 Fix indexing of messages

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala?rev=885267&r1=885266&r2=885267&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala Sun Nov
29 21:17:02 2009
@@ -102,8 +102,24 @@
     idCache.remove(msg.id)
   }
 
+  def indexMessage(msg: Message) {
+    for(session <- compass.map(_.openSession())) yield {
+      var tx:CompassTransaction = null
+
+      try {
+        tx = session.beginTransaction()
+        session.save(msg)
+        tx.commit();
+      } catch  {
+        case ce: CompassException =>
+          if (tx != null) tx.rollback();
+      } finally {
+        session.close();
+      }
+    }
+  }
 
-  override def afterCommit = super.afterCommit
+  override def afterCommit = indexMessage _ :: super.afterCommit
 
   private def saveTags(msg: Message) {
     msg.saveTheTags()



Mime
View raw message