Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Control your application's agents with this Agent Launchers tool (continued)

Creating self-launching agents
Using a single scheduled agent to periodically check schedules and launch agents is very flexible and can work well in most applications, with one significant exception. You might have several slow agents that execute to completion by themselves, but when run on one schedule cause the launcher agent to exceed the time limit specified in the server document.

To work around this kind of situation, you can create a self-launch schedule document and set each slow agent to launch itself. The agent should use slAGTLauncher and call fnCanLaunch before allowing itself to do anything. After executing successfully, it should then call subSuccess to update the Last Launched Date in its schedule document. The following Sample Agent is an example of a self-launching agent:

Sub Initialize 'agtSample3b
'Designed to self-launch
Dim s As New NotesSession, db As NotesDatabase
Set db = s.CurrentDatabase

Dim logThisDB As New NotesLog ("agtSample3b: Delete Draft Orders")
Call logThisDB.OpenNotesLog( db.server, db.filepath )

If fnCanLaunch ("agtSample3b", "selflaunch", True) Then
Call logThisDB.LogAction ( "Started. (UI or self-sched)" )
Call logThisDB.LogAction ( " Pretending to delete all unsubmitted draft orders." )
Call logThisDB.LogAction ( "Done." )
Call subSuccess
End If
End Sub 'agtSample3b

Testing
To quickly put the auto- and self- launchers through their paces, the sample database includes a "Create Sample Schedules" agent. This agent creates a set of sample schedules based on the current system time. After creating these sample schedules, you can run the launchers against them and verify that each agent's schedule was applied correctly.

The sample agents named in the sample schedules don't actually do anything, but they're named after tasks that agents commonly perform. For example, the "Sample Agent: Register" agent can be run by any user, but only from the user interface. The "Sample Agent 5: Archive Old Orders" agent can be run by an administrator at any time, and it's scheduled to auto-launch monthly.

To make it easy to see which agents were launched and when, the sample database contains the design elements of a standard Notes Log (from the StdR4AgentLog template). Each agent prints to this log as it executes:

Sub Initialize 'agtSample1
Dim s As New NotesSession, db As NotesDatabase
Set db = s.CurrentDatabase
Dim logThisDB As New NotesLog ("agtSample1: Register")
Call logThisDB.OpenNotesLog( db.server, db.filepath )
Call logThisDB.LogAction ( "Started. (UI)" )
Call logThisDB.LogAction ( " Pretending to register the current user." )
Call logThisDB.LogAction ( "Done." )
End Sub 'agtSample1

The Agent Log is pictured in Figure E.

FIGURE E


Here is the Agent Log. Roll over picture for a larger image.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  6  ·  7  ·  Next »
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login