如何在JMeter中测试异步回调? [英] How can I test async callbacks in JMeter?

查看:670
本文介绍了如何在JMeter中测试异步回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的API中使用WebHooks.因此,一旦处理了请求,我们的REST服务就会将响应回发到请求中发送的回调URL.

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)        |
  |                  |

如何用JMeter进行压力测试?

How can this be stress tested with JMeter?

推荐答案

如果要轮询,则取决于WebHook的实现-您可以只使用交易控制器

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

如果回调来自服务器发送的事件,则可以使用 JAX RS API ,它提供了 JSR223采样器

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

这篇关于如何在JMeter中测试异步回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆