PeopleSoft Daemon Application Engine Example
By Chris Malek | Wed, Jun 6, 2012
There is an Application Engine process type that is called a daemon. This is a special process type that “continuously” runs in the background looking for certain conditions and if the conditions are met, it will trigger something. Generally, this “something” is another process. We have continuously in quotes because it runs on a heartbeat and is not running in an infinite loop. Here are some examples of things that could be monitored:
- The existence of a file on a server
- Vendor files
- Error files
- The existence or non-existence of data in the database
The daemon application engine type is not documented very well in PeopleBooks. It is actually a pretty simple concept. Let’s walk through an example.
Let’s say that we have vendor that will post a file to an FTP directory at any time during the day. The vendor could post several files throughout the day or none. When the vendor puts a new file in the directory, we want a process to run which will load the file into the database.
In order to process this type of scenario, you would actually need two distinct processes which might seem confusing at first.
A daemon application engine that runs “continuously” in the background looking for the presence of a new file
- If the file (or any condition you code) is not found, then the process exits without doing anything.
- If the file (or any condition you code) is found, then this daemon process schedules a run of the secondary process that does the actual work.
The secondary processes runs to process the file and update the database.
- Why do we need two processes?
- Why can’t I just put all the logic in the daemon program and have it run continuously?
These are good questions. The answer is simple. You want the daemon process that looks for the presence of a condition (a new file in our example) to run quickly and complete before the next heartbeat interval. You just want the daemon to run to determine “does condition x exist?” If the condition exists, we need to tell someone to go do some more work. That someone is another process.
Here is the pseudo code for the daemon
- Does a new file exist?
- If not then exit
- If exists then schedule a new process using the Process Request API
That is all the logic that should be in the daemon application engine.
PeopleSoft Simple Web Services (SWS)
Do you need a quick way to create web services?
Introducing a small but powerful PeopleSoft bolt-on that makes web services very easy. If you have a SQL statement, you can turn that into a web service in PeopleSoft in a few minutes.
Integration Broker - The Missing Manual
I am in the process of writing a book called "Integration Broker - The Missing Manual" that you can read online.