Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dubbo provider add getBusinessParams #217

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,16 @@ protected Object getUrl(Object instance, Object invocation) throws Exception {
}
return ReflectUtil.invokeMethod(instance, GET_URL, new Object[0], false);
}

@Override
protected Map<String, Map<String, String>> getBusinessParams(final Object invocation) throws Exception {
return BusinessParamUtil.getAndParse(DubboConstant.TARGET_NAME, new BusinessDataGetter() {
@Override
public String get(String key) throws Exception {
Map<String, String> attachments = ReflectUtil.invokeMethod(invocation, GET_ATTACHMENTS, new Object[0], false);
if (attachments == null || attachments.isEmpty()) {
return null;
}
return attachments.get(key);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

import com.alibaba.chaosblade.exec.common.aop.EnhancerModel;
import com.alibaba.chaosblade.exec.common.model.action.delay.TimeoutExecutor;
import com.alibaba.chaosblade.exec.common.util.BusinessParamUtil;
import com.alibaba.chaosblade.exec.common.util.ReflectUtil;
import com.alibaba.chaosblade.exec.plugin.dubbo.DubboConstant;
import com.alibaba.chaosblade.exec.plugin.dubbo.DubboEnhancer;
import com.alibaba.chaosblade.exec.spi.BusinessDataGetter;

import java.util.Map;

Expand All @@ -41,8 +43,17 @@ protected TimeoutExecutor createTimeoutExecutor(ClassLoader classLoader, long ti
}

@Override
protected Map<String, Map<String, String>> getBusinessParams(Object invocation) throws Exception {
return null;
protected Map<String, Map<String, String>> getBusinessParams(final Object invocation) throws Exception {
return BusinessParamUtil.getAndParse(DubboConstant.TARGET_NAME, new BusinessDataGetter() {
@Override
public String get(String key) throws Exception {
Map<String, String> attachments = ReflectUtil.invokeMethod(invocation, GET_ATTACHMENTS, new Object[0], false);
if (attachments == null || attachments.isEmpty()) {
return null;
}
return attachments.get(key);
binbin0325 marked this conversation as resolved.
Show resolved Hide resolved
}
});
}

@Override
Expand Down