symimake wrote:So how can I achieve that?
if put it into sheduler service then it run periodically and I want to run it continuously without interrupting Jiwa main thread. Can you suggest anything to tackle this kind of scenario?
Design of systems is beyond the scope of what these forums are for - if you want to engage our services we have a lot of experience in designing and building systems, particularly integrations with Jiwa. You can do that by lodging a ticket at
https://helpdesk.jiwa.com.auBut, to throw you a bone - the simplest way forward for what you have in place already is:
1. Keep the ScheduledExecutionPlugin as the thing which runs on a periodic schedule (just move your code out of the OnServiceStart method and put it into the Execute method - and that code will change - see point 3)
2. Add a route to the API to dequeue - you can make this internal as it's not supposed publicly accessible - easiest way is in the service handling the request to dequeue, check for a secret in the request header
3. In the Execute of the ScheduledExecutionPlugin, call the internal route defined in #2 (set secret key header if that's how you plan internal use only enforcement) - just like you'd call any external route - I recommend using the HttpUtils string extensions - so it's really as easy as "http://localhost/internal/inventory/dequeue".GetBytesFromUrl() - you can GetStringFromUrl or PostToUrl as well - see the
ServiceStack docs on HttpUtils.
This is a back-of-a-napkin design - I don't know what your environment constraints or anything like that are, so take my suggestion without warranty.