I want to send message into eventhub using locust task, but looks like it doesn't support async tasks, like Asyncio support, how could i do it then?
it would stucked when process locust -f
and then stop with send event timeout.
I'm trying to run a time-intensive process in my jobs queue. I have an event being triggered which sends out a socket command to connected users and I have a job that gets queued after that which can run in the background. Before now, I've never run php artisan queue:work and my events system was working flawlessly. Now I'm trying to process my jobs and my events AND jobs are trying to be processed by the same queue worker.
Here is the code that I use to trigger these:
event(new ActivateItemAndUpdateRotation($id));
ChangeStatus::dispatch($id, $status);
This is really bad for my performance because the users can change statuses really quickly which needs to be updated rapidly and the jobs can just do their thing as they're able to in the background. I've tried adding the jobs to a specific queue and only running that queue worker, but then the events don't get processed at all. So really I have two questions:
how have events been getting processed without running a worker up until now?
is it necessary to have two workers running now to process the events and the jobs asynchronously?
I would implement a timeout event in quarkus and I search the best way to do that.
Problem summary :
I have a process who wait answer from a REST service
If the service is call, I'll go to next process
If the service isn't call before the delay => I must not validate the process and go to the next process
So I'm thinking of using the quarkus event bus, with a delayed message. If the message is send, I close the process and go to the next process. If the client answer before the delay, the message will never be send (how can do that?)
Thanks you
I am trying to trigger a spring batch execution from endpoint. I have implemented a service at the backend. So from Vue i am trying make a call to that endpoint.
async trigger(data) {
let response = await Axios.post('')
console.log(response.data.message)
}
My service at the backend returns a response " Batch started" and does execution in the background since it is async but does not return back once job is executed(i see the status only in console). In such scenario how can i await the call from vue for the service execution to complete. I understand that service send no response once execution is complete/failed. Any changes i need to make either at the backend or frontend to support this. Please let me know your thoughts.
It's like you said, the backend service is asynchronous, which means that once the code has been executed, it moves to the next line. If no next line exits, the function exists, the script closes, and the server sends an empty response back to the frontend.
Your options are:
Implement a websocket that broadcasts back when the service has been completed, and use that instead.
Use a timeout function to watch for a flag change within the service that indicates that the service has finished its duties, or
Don't use an asynchronus service
how can i await the call from vue for the service execution to complete
I would not recommend that since the job may take too long to complete and you don't want your web client to wait that long to get a reply. When configured with an asynchronous task executor, the job launcher returns immediately a job execution with an Id which you can inspect later on.
Please check the Running Jobs from within a Web Container for more details and code examples.
My suggestion is that you should make the front-end query for the job status instead of waiting for the job to complete and respond because the job may take very long to complete.
Your API to trigger the job start should return the job ID, you can get the job ID in the JobExecution object. This object is returned when you call JobLauncher.run.
You then implement a Query API in your backend to get the status of the job by job ID. You can implement this using the Spring JobExplorer.
Your front-end can then call this Query API to get the job status. You should do this in an interval (E.g. 30 secs, 5 mins, .etc depending on your job). This will prevent your app from stuck in waiting for the job and time-out errors.
I'm wondering if it's possible to respond to a http request using the std http package and still keep the go routine alive ( e.g. run a task intensive task ). The use case is that I need to receive a http request and then call back that service after few minutes
Just spawn a new goroutine from your handler and keep that alive as long as you like.