Hi Eric
If you want your service t0 be part of the framework, but not actually use any specific connection functionality typically offered by adapters (SQL, FILE, ..etc) Just ensure that the adapter is first set to 'Ens.InboundAdapter':
And - set your PoolSize is set to 1, so a job is started. with the production. Note that for every cycle of the Call Interval setting, the OnProcessInput method will be called.
If you want to regularly do your work (ie: "go through a list of values in a global and compare dates. If criteria is met, it will send an email."), then, do this in the OnProcessInput method at your desired CallInterval.
However - As you said "on start..." I'm assuming you meant, on start of the production as a whole - In this case, leave the OnProcessInput method empty with just a
statement, and, (as others mentioned here), put the logic in the OnInit() method of your service, which will be invoked on production startup or enabling/disabling of the service.
Note that without the Adapter parameter setting above, and the pool size set to 1 - neither OnInit, nor OnProcessInput are called.
Now - Productions are meant to keep on running. You may eventually move away from putting this logic in the OnInit code or somewhere which requires a Production re-start in order to execute, as this effects other running business hosts .... To explore other options further you can
(a) Work with the CallInterval which calls OnProcessInput after n seconds, and build in logic that determines if a particular cycle should just do nothing, or (say, on the change of the day, or other controlling factors, like, the size of your global entries) - would go ahead and do the emails. Note that you can set Properties for your business service, to record state - which you can initialise a value for in the OnInit, and update regularly during the running state of the service if you need to.
(b) Look at the Schedular feature. The Schedular feature controls the running state of a business host. With the schedular you can elect to Enable/Disable any service on a pre-defined schedule. So - You can enable your service, (with OnInit code to check globals and send emails), at an interval of choice without needing to stop/start the production. click : here for documentation.
Sincerely -
Steve
- Log in to post comments