diff --git a/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql
index a6df67a3271954b32b7c1e1105c26e7dbfba76e8..ae59918ba62bcf73c792a858e81c89dd41db57f0 100755
--- a/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_assignMessage.zsql
@@ -9,11 +9,17 @@ class_file:
 </dtml-comment>
 <params>path
 processing_node
-method_id</params>
+method_id
+uid=None</params>
 UPDATE message
 SET
   processing_node=<dtml-sqlvar processing_node type="int">,
   processing=0
 WHERE
+<dtml-if uid>
+<dtml-in uid>uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>
+ OR </dtml-if></dtml-in>
+<dtml-else>
   path = <dtml-sqlvar path type="string">
-<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
\ No newline at end of file
+<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
+</dtml-if>
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql b/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql
index 608ac8f6808b7777e951e2a98c1f90836d10a1f6..aea81bfac4a3c72f0316e53bddf348c2b605c144 100755
--- a/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_createMessageTable.zsql
@@ -9,15 +9,17 @@ class_file:
 </dtml-comment>
 <params></params>
 CREATE TABLE `message` (
+  `uid` int(11) NOT NULL auto_increment,
   `path` VARCHAR(255),
   `method_id` VARCHAR(40),
   `processing_node` INT DEFAULT -1,
   `processing` INT DEFAULT 0,
   `priority` INT DEFAULT 0,
   `message` BLOB,
+  PRIMARY KEY  (`uid`),
   KEY `path` (`path`),
   KEY `method_id` (`method_id`),
   KEY `processing_node` (`processing_node`),
   KEY `processing` (`processing`),
   KEY `priority` (`priority`),
-) TYPE = InnoDB;
+) TYPE = InnoDB;
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_delMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_delMessage.zsql
index 762bbd785c508cdcecf27695dfc1737988eced56..ce78ddf2a8ff85b0a2d8ebb79f037c0b568ae48f 100755
--- a/product/CMFActivity/skins/activity/SQLDict_delMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_delMessage.zsql
@@ -7,14 +7,9 @@ cache_time:0
 class_name:
 class_file:
 </dtml-comment>
-<params>path
-method_id
-processing_node
-processing</params>
+<params>uid:list</params>
 DELETE FROM
-  message
+	message
 WHERE
-  path = <dtml-sqlvar path type="string">
-<dtml-if method_id> AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
-<dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"></dtml-if>
-<dtml-if processing> AND processing = 1</dtml-if>
+<dtml-in uid>uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
+</dtml-in>
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql
index c0ab4f46fa5be6946c0aa1fe67690c9e0c4bdad1..742e23c4ea40f5f738f36edafd9cc40f47904bef 100755
--- a/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_hasMessage.zsql
@@ -16,4 +16,5 @@ WHERE
 <dtml-if path>  path = <dtml-sqlvar path type="string"></dtml-if>
 <dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
 </dtml-if>
+
   
diff --git a/product/CMFActivity/skins/activity/SQLDict_processMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_processMessage.zsql
index 61bdb07dc965be0ed3f54e3f9f083cf5de7cd027..23dbae6cdd2285aece7834bd2222fc3e7d46db6a 100755
--- a/product/CMFActivity/skins/activity/SQLDict_processMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_processMessage.zsql
@@ -7,12 +7,9 @@ cache_time:0
 class_name:
 class_file:
 </dtml-comment>
-<params>path
-method_id
-processing_node</params>
+<params>uid</params>
 UPDATE message
 SET processing=1
 WHERE
-    path = <dtml-sqlvar path type="string">
-AND method_id = <dtml-sqlvar method_id type="string">
-AND processing_node = <dtml-sqlvar processing_node type="int">
+<dtml-in uid>uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>
+ OR </dtml-if></dtml-in>
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql
index 54374d4165ed3920b2c7153215a489ee56511944..e14daab5c9ab961a4c0dd6aa4821a236fa90ffca 100755
--- a/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_readMessage.zsql
@@ -12,7 +12,9 @@ priority</params>
 SELECT * FROM
     message
 WHERE
-    processing = 0
+    processing <> 1
 <dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"></dtml-if>
-<dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if>
+<dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if> 
 
+ORDER BY
+    priority
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql b/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql
index 6d0c8ee869d1118373f80ddf80033a3c25e8d243..823737764c46f144262abfb3e9aff22d9a081c0a 100755
--- a/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_readMessageList.zsql
@@ -12,10 +12,12 @@ method_id
 processing_node
 priority</params>
 SELECT * FROM
-  message
+    message
 WHERE
-    processing = 0
+    processing <> 1
 <dtml-if processing_node>AND processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if>
 <dtml-if priority>AND priority = <dtml-sqlvar priority type="int"> </dtml-if>
 <dtml-if path>AND path = <dtml-sqlvar path type="string"></dtml-if>
 <dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
+GROUP BY
+     path, method_id, processing_node, processing
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql
new file mode 100755
index 0000000000000000000000000000000000000000..86145a6f66dd17380f0b6a1a4c2f9ce7f557d61b
--- /dev/null
+++ b/product/CMFActivity/skins/activity/SQLDict_readUidList.zsql
@@ -0,0 +1,19 @@
+<dtml-comment>
+title:
+connection_id:erp5_sql_connection
+max_rows:10000
+max_cache:100
+cache_time:0
+class_name:
+class_file:
+</dtml-comment>
+<params>processing_node
+method_id
+path</params>
+SELECT uid FROM
+    message
+WHERE
+    processing <> 1
+<dtml-if processing_node> AND processing_node = <dtml-sqlvar processing_node type="int"></dtml-if>
+<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
+<dtml-if path>AND path = <dtml-sqlvar path type="string"></dtml-if>
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql b/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql
index 2f0bfd1330af9923d847e3eaa9c029511400384a..4c3dc3669216b5e7202bc90b002c861ba2f1c175 100755
--- a/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_setPriority.zsql
@@ -7,15 +7,13 @@ cache_time:0
 class_name:
 class_file:
 </dtml-comment>
-<params>path
-method_id
-priority
-processing_node</params>
+<params>uid:list
+priority</params>
 UPDATE
 	message
 SET
-	priority = <dtml-sqlvar priority type="int">
+	priority = <dtml-sqlvar priority type="int">,
+	processing = 0
 WHERE
-	path = <dtml-sqlvar path type="string">
-AND	method_id = <dtml-sqlvar method_id type="string">
-AND	processing_node = <dtml-sqlvar processing_node type="int">
\ No newline at end of file
+<dtml-in uid>uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>
+ OR </dtml-if></dtml-in>
\ No newline at end of file
diff --git a/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql b/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql
index be75351924ee86098578f7e661d55fd0dbda8993..8c9e58c198498b3220c22768a8a1843575ccfc30 100755
--- a/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql
+++ b/product/CMFActivity/skins/activity/SQLDict_writeMessage.zsql
@@ -9,8 +9,13 @@ class_file:
 </dtml-comment>
 <params>path
 method_id
-priority
-message</params>
+message
+priority</params>
 INSERT INTO message
-VALUES
- (<dtml-sqlvar path type="string">,<dtml-sqlvar method_id type="string">,-1,0,<dtml-sqlvar priority type="int">,<dtml-sqlvar message type="string">);
+SET
+	path = <dtml-sqlvar path type="string">,
+	method_id = <dtml-sqlvar method_id type="string">,
+	processing_node = -1,
+	processing = -1,
+	priority = <dtml-sqlvar priority type="int">,
+	message = <dtml-sqlvar message type="string">
\ No newline at end of file