I think you need a “global variable” to keep track if your service has run before 9AM (then the service is fired by the notification). If the services is fired by an event, mark the global variable as “processsed”. When the scheduled serviceA runs at 9AM, check this variable. If variable is processed, stop and do nothing. Otherwise do your thing.
How to implement this global variable thing. You have to find a place in your environment that is shared by all your IS instances (when you are in a cluster). Options:
- Use repo server
- Use a memory
- Use a file
- won’t recomment this one, because sometimes very slow
- Data lost at restart. You have to keep memory of all IS instances in sync. You can do a service call to “getBrokerHosts” and do a http call to a service that sync’s the memory (make this service Anynumous) on every IS
- Only applicabale when you have a shared file system. When you have, i would recomment this option.
When not in a cluster, just use a file. Easy, quick and no hassle.