Commit b68ad228 authored by Jean-Paul Smets's avatar Jean-Paul Smets

added process message SQL


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@323 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 247ad2ab
...@@ -52,7 +52,7 @@ class SQLDict(RAMDict): ...@@ -52,7 +52,7 @@ class SQLDict(RAMDict):
path = line.path path = line.path
method_id = line.method_id method_id = line.method_id
# Make sure message can not be processed anylonger # Make sure message can not be processed anylonger
activity_tool.SQLDict_assignMessage(path=path, method_id=method_id, processing_node = INVOKE_ERROR_STATE) activity_tool.SQLDict_processMessage(path=path, method_id=method_id, processing_node = processing_node)
get_transaction().commit() # Release locks before starting a potentially long calculation get_transaction().commit() # Release locks before starting a potentially long calculation
m = self.loadMessage(line.message) m = self.loadMessage(line.message)
if m.validate(self, activity_tool): if m.validate(self, activity_tool):
...@@ -62,7 +62,7 @@ class SQLDict(RAMDict): ...@@ -62,7 +62,7 @@ class SQLDict(RAMDict):
get_transaction().commit() # If successful, commit get_transaction().commit() # If successful, commit
else: else:
get_transaction().abort() # If not, abort transaction and start a new one get_transaction().abort() # If not, abort transaction and start a new one
#activity_tool.SQLDict_assignMessage(path=path, method_id=method_id, processing_node = INVOKE_ERROR_STATE) activity_tool.SQLDict_assignMessage(path=path, method_id=method_id, processing_node = INVOKE_ERROR_STATE)
# Assign message back to 'error' state # Assign message back to 'error' state
get_transaction().commit() # and commit get_transaction().commit() # and commit
else: else:
......
...@@ -12,8 +12,10 @@ CREATE TABLE `message` ( ...@@ -12,8 +12,10 @@ CREATE TABLE `message` (
`path` VARCHAR(255), `path` VARCHAR(255),
`method_id` VARCHAR(40), `method_id` VARCHAR(40),
`processing_node` INT DEFAULT -1, `processing_node` INT DEFAULT -1,
`processing` INT DEFAULT 0,
`message` BLOB, `message` BLOB,
KEY `path` (`path`), KEY `path` (`path`),
KEY `method_id` (`method_id`), KEY `method_id` (`method_id`),
KEY `processing_node` (`processing_node`), KEY `processing_node` (`processing_node`),
KEY `processing` (`processing`),
) TYPE = InnoDB; ) TYPE = InnoDB;
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1
max_cache:0
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>path
method_id
processing_node</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">
...@@ -10,7 +10,8 @@ class_file: ...@@ -10,7 +10,8 @@ class_file:
<params>processing_node</params> <params>processing_node</params>
SELECT * FROM SELECT * FROM
message message
<dtml-if processing_node>
WHERE WHERE
processing_node = <dtml-sqlvar processing_node type="int"> processing = 1
<dtml-if processing_node>
AND processing_node = <dtml-sqlvar processing_node type="int">
</dtml-if> </dtml-if>
\ No newline at end of file
...@@ -12,9 +12,8 @@ method_id ...@@ -12,9 +12,8 @@ method_id
processing_node</params> processing_node</params>
SELECT * FROM SELECT * FROM
message message
<dtml-if "path or method_id or processing_node">
WHERE WHERE
<dtml-if processing_node> processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if> processing = 1
<dtml-if path><dtml-if processing_node>AND</dtml-if> path = <dtml-sqlvar path type="string"></dtml-if> <dtml-if processing_node>AND processing_node = <dtml-sqlvar processing_node type="int"> </dtml-if>
<dtml-if method_id><dtml-if "processing_node or path">AND</dtml-if> method_id = <dtml-sqlvar method_id type="string"></dtml-if> <dtml-if path>AND path = <dtml-sqlvar path type="string"></dtml-if>
</dtml-if> <dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
\ No newline at end of file
...@@ -12,4 +12,4 @@ method_id ...@@ -12,4 +12,4 @@ method_id
message</params> message</params>
INSERT INTO message INSERT INTO message
VALUES VALUES
(<dtml-sqlvar path type="string">,<dtml-sqlvar method_id type="string">,-1,<dtml-sqlvar message type="string">); (<dtml-sqlvar path type="string">,<dtml-sqlvar method_id type="string">,-1,0,<dtml-sqlvar message type="string">);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment