简体   繁体   English

JMeter:如何处理异步http发布请求

[英]JMeter : How to handle asynchronous http post request

I'm trying to automate a POST call where I'm getting multiple responses every 5 seconds. 我正在尝试自动执行POST呼叫,每5秒会收到多个响应。

For example, while uploading a file, 例如,在上传文件时,

file read......200 OK 文件读取...... 200 OK

Uploading Started.....200 OK 上传开始..... 200确定

Uploaded......200 OK 上传...... 200 OK

And after certain time, when the process is complete on the server side, I get a response saying "Finished Successfully...200 OK". 并在一段时间后,在服务器端完成该过程后,我收到响应,提示“成功完成... 200 OK”。

But in JMeter, connection is closed when first 200 is received. 但是在JMeter中,当收到前200个消息时,连接将关闭。 How can I wait for all the responses conditionally and exit when the desired response is received by the request? 如何有条件地等待所有响应并在请求收到所需的响应时退出?

You will have to use Java Request and develop a custom org.apache.jmeter.protocol.java.sampler.JavaSamplerClient class. 您将必须使用Java Request并开发一个自定义org.apache.jmeter.protocol.java.sampler.JavaSamplerClient类。

You can use http://hc.apache.org/httpcomponents-client-ga/ for the HTTP Client library, but ensure you use the same as JMeter. 您可以将http://hc.apache.org/httpcomponents-client-ga/用于HTTP客户端库,但请确保使用与JMeter相同的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM