Solved

Mail-in Agent proceses documents more than once

Posted on 2004-03-30
4
402 Views
Last Modified: 2013-12-18
I have a database with a LotusScript mail-in Agent set to "after new mail has arrived". The problem is that my Agent randomly processes the same document more than once. The server is Domino 6.0.2 CF2.

Yesterday I made five tests, each with eight new mails sent at the same time. There was a delay of approx. 45 minutes between each test. Before starting the next test I deleted the documents received in the previous test.

Test 1: everything was fine.

Test 2: three out of eight memos received were processed twice. The second run started exactly 15 minutes after the first run.

Test 3: see Test 1.

Test 4: two out of eight memos received were processed twice. The second run started exactly 2 Minutes after the first run.

Test 5: see Test 3.

In the last test two mails out of eight were processed three times. The second run started exactly 15 minutes after the first run and the third run with a further delay of 16 minutes.

After my last test I went at home, leaving the eight documents in the database. This morning I've seen that all eight documents have been processed again at night, 0:03, when the Agent Manager's agent cache gets updated.

Now I restartet the Agent manager and all documents were processed again.

The agent processes the documents very fast (all eight documents within same second).

Basically the agent processes data received in a message from a Web application. It extracts pairwise (field=value) some data from the body text and writes the data into another notes document. Finally it stamps the memo form with a status.

The agent processes the documents using the following structure (original code with overhead removed):
Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase          
  Dim dc As NotesDocumentCollection
  Dim memo As NotesDocument
  Dim status As Integer

  On Error Goto Error_Handler  
  Set db = session.CurrentDatabase
  Set dc = db.UnprocessedDocuments
  Set memo = dc.GetFirstDocument
  While Not memo Is Nothing
    ' *** Processing takes place here ***
    '
   
    '    
    memo.Status = "1"
Next_Memo:
    Call memo.Save( True, True )        
    Set memo = dc.GetNextDocument( memo )
  Wend
 
Exit_Sub:
  Exit Sub
 
Error_Handler:
 if Not memo Is Nothing Then
   ' Write error into memo, set status and continue with next memo
    memo.ErrorText = Cstr(Err) & ": " & Error & ", Zeile " & Cstr(Erl)
    memo.Status = "2"
    Resume Next_Memo  
  Else
    ' Stop processing.
    Print "Error " & Cstr(Err) & ": " & Error & _
    " in Agent 'Dispatcher' " & db.Title & " (db.FilePath)"
    Resume Exit_Sub    
  End If  
End Sub

As a workaround, I check the status in the while loop and do no processing an documents having a Status field. However, this is not a solution, since I need to keep the documents for a while.

Is there a known problem or what am I doing wrong?

Peter
0
Comment
Question by:pgloor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 500 total points
ID: 10713712
To avoid agent from processing the documents again and again you have to use this function

Call notesSession.UpdateProcessedDoc( notesDocument )

So that agent will mark this as processed and then it will not touch them again and again

~Hemanth
0
 
LVL 5

Author Comment

by:pgloor
ID: 10713803
Whoops... Sorry, actually I made 6 tests and mixed up my test results.
Read it as follows:

Test 1: everything was fine.

Test 2: three out of eight memos received were processed twice. The second run started exactly 15 minutes after the first run.

Test 3: see Test 1.

Test 4: two out of eight memos received were processed three times. The second run started exactly 15 minutes after the first run and the third run with a further delay of 16 minutes.

Test 5: two out of eight memos received were processed twice. The second run started exactly 2 Minutes after the first run.

Test 6: see Test 4.

0
 
LVL 5

Author Comment

by:pgloor
ID: 10714150
@~Hemanth,

I obviousely removed Call session.UpdateProcessedDoc( memo ) by accident when I added the Next_Memo label.

Thanks.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10714195
Accidents do happen ;-)
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question