Lewis Greitzer · Aug 29, 2017

ad hoc sql service

Hi everyone, I have a SQL service that is working fine, except I don't want it to run on a schedule or continuously. I'd like to only run when requested. Run once and then stop until another request. Is there anyway to set up a service like that?

0 353
Discussion (4)2
Log in or sign up to continue

Where is the SQL residing and how do want to trigger it?

If it's sitting on a local Cache server you can start it any number of ways: web page, Cache routine menu, text/email a listener routine, hit a JSON service, "Alexa, start my SQL query", push a big red button, etc.

If on the cloud somewhere or on someone else's server behind a firewall you have to get past authentication/firewall to start the query.

- Tom Fitzgibbon | 9179331226 | gototomAtG...l

Since 86400 is the number of seconds in one day, did you mean to write "it will run every day" rather than "it will run every two days"? Or have I misunderstood something?

It's an external database, I have the java gateway service up and running. I just want to go into ensemble, start the service and have it run through my database once and stop. I update a processed flag in the database, so the next pass won't pick up already read records.  Right now I have the call interval set to 86400, so it will run every two days, which would be ok, but really not needed.

If you have a flag on your database that you set after reading the records, and this flag has an Index, you should be fine. Why bother? I mean: You could set this to be run every hour and process the records that have the right flag...

But if you really need to run your service on a specific schedule I would suggest  changing your architecture. Try creating a Business Service without an adapter (ADAPTER=Ens.InboundAdapter) so you can call it manually through Ens.Director.CreateBusinessService(). On the Business Service, call a Business Process that will call a Business Operation and grab the data for you. Then your Business Process will receive the data and do whatever needs to be done with it, maybe calling other Business Operations.

If that works, create a task (a class than inherits from %SYS.Task.Definition) that will create an instance of your business service using Ens.Director and call it. Configure the task to run on whatever schedule you need such as "Once a day at 12PM" or "Every hour" or "On monday, at 12AM", etc.

Kind regards,