jmeter-plugins-for-apache-dubbo icon indicating copy to clipboard operation
jmeter-plugins-for-apache-dubbo copied to clipboard

隐式参数传递支持map数据结构

Open lsc1943 opened this issue 2 years ago • 1 comments

我们这边使服务端用dubbo会在RpcContext.getContext().setAttachment(key, value)里的value中使用一个map而不是字符串, 现在的方式直接序列化过去是string导致服务端无法解析。 我这边稍微修改了下让它沿用ClassUtils.parseParameter兼容其他数据格式的反序列化。 List<MethodArgument> attachmentArgs = Constants.getAttachmentArgs(this); if (attachmentArgs != null && !attachmentArgs.isEmpty()) { List<String> attachmentParameterTypeList = new ArrayList<String>(); List<Object> attachmentParameterValueList = new ArrayList<Object>(); for(MethodArgument attachmentArg : attachmentArgs) { ClassUtils.parseParameter(attachmentParameterTypeList, attachmentParameterValueList, attachmentArg); } IntStream.range(0, attachmentParameterValueList.size()).forEach(i -> RpcContext.getContext().setAttachment(attachmentParameterTypeList.get(i), attachmentParameterValueList.get(i))); }

lsc1943 avatar Jul 30 '21 04:07 lsc1943

@lsc1943 可以的

ningyu1 avatar Aug 05 '21 10:08 ningyu1