Polling from within ER

MrChuckles

MrChuckles

Member
I am looking at integrating a third-party application with EnterpriseOne and have a question regarding 'polling' on the return transaction.

The plan is execute a call from within a 'C' business function and interactively call a custom NER. This NER would parse the data, create a flat text file (ie. a REQUEST transaction), and then copy the flat file (REQUEST) to an 'Exported' directory on the network. The third-party software continuously monitors for files in the 'Exported' directory, processes the transactions, creates a separate flat text file (ie. a RESPONSE transaction), and then copies the RESPONSE text file to an 'Import' directory on the network.

My question is, how do I code the NER to keep polling the 'Import' directory to see if a RESPONSE has been generated? I do not want the NER to return to the calling 'C' business function until either, a RESPONSE has been received, or a pre-determined amount of time has passed (eg. 30 seconds, or so, in which case I'd pass back a status of 'timed out').

I know how to check to see if a RESPONSE has been returned, but I'm not sure how to assign a predetermined 'TIME' limit to the loop?

Any 'best practice' ideas, or constructive thoughts would be appreciated for someone who has done something similar.

Thanks for your assistance.
 
Kerry,

You could just put a UBE on the scheduler and have it run ever five minutes
to see if the 'change' has occured?

UBEs are not REPORTS - they are Universal Batch Engines (that most-often
contain reports)...

Would that work for you?

(db)

On Tue, May 20, 2008 at 2:16 PM, MrChuckles <[email protected]>
wrote:



--
 
Daniel, thanks for your reply. However, for our purposes we need to read the response as soon as it occurs.

The third-party software is a credit card authorization package. We are simply passing a REQUEST transaction (as a flat text file) into an 'Export' folder. The third-party credit card application continuously monitors this 'Export' folder, waiting for a transaction. When a REQUEST transaction is received, it immediately processes the REQUEST, and generates a RESPONSE (as a flat text file) into an 'Import' folder, which contains either an 'Authorized', 'Declined', or 'Error' status message. This should only take a few seconds.

This is where, I need a method to somehow continuously monitor (from within the E1 application, NER, or UBE), the 'Import' directory to see when a RESPONSE has been issued, and if so, what type of response. Then I'll be able to take the appropriate action.

Somebody has got to have done something similar in the past, so I'm open to suggestions or best practices as to how to monitor the RESPONSE as soon as it occurs (but within a predefined amount of time before it times out).

I await everyone's expertice, as this has got me stumped.
 
If the target of this is a Windows machine, you can accomplish this at the OS level. Somewhere in the Windows APIs is a procedure that will notify a callback procedure of a change in a folder (file added, deleted, modified, etc.). It's been a while since I've done any straight Windows programming, so I don't recall the exact name of the Windows procedure, but it shouldn't be hard to find, or very difficult to write the callback procedure in C. The beauty of this is that it avoids constantly polling a folder, which can be both network and disk intensive, unless you're very careful about the frequency and duration of your polling.

You should consider adding the specifics of your environment to your signature, as that will help get you help better suited to your environment. For example, if you're in a Unix or iSeries shop, this suggestion may not even be an option.
 
Another option to explore is to create the UBE as a subsystem job. The subsystem job continually monitors for a record in the subsystem table F986113. To get this to work your external program would need to write a record to the subsystem table just after creating your flat file. There is some decent documentation from the 8.10 version on how to set up a subsystem job.

Steven
 
I had thought subsystem job, initiallly, also - but there was something
missing in my original logic (and I don't remember what).

Another possibility - table trigger. Either Update the Subsystem Table,
based on the Insert or do a submit to RunUBE from the trigger. Just a
couple thoughts.

(db)

On Wed, May 21, 2008 at 11:08 AM, JDEDeveloper3 <[email protected]>
wrote:



--
 
Back
Top