I am using WebHooks in my API. So, once a request is processed our REST Service will POST a response back to the callback URL sent in the request.
Client Server
|(request) |
|----------------->|
|<-----------------| ||
| (response)| ||
| | _||_ Time
| (callback)| \ /
|<-----------------| \/
|----------------->|
|(response) |
| |
How can this be stress tested with JMeter?
It depends on WebHook implementation, if it is a matter of polling - you can just use While Controller to wait for callback in loops. The whole duration of the sequence can be measured using i.e. Transaction Controller
If the callback comes a a Server-Sent Event you can use i.e. JAX RS API which provides SseEventSource class which can be used for waiting for server-side events either in JSR223 Sampler or in Java Request sampler like described in Stress/Load-Testing of Asynchronous HTTP/REST Services with JMeter article