提交 8956b9b9 编写于 作者: C carlvine

rocketMQ-3.x-plugin class MQVersion cause ClassNotFoundException

上级 e56a5e68
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.plugin.rocketMQ.v3;
/**
* copy from {@link com.alibaba.rocketmq.common.MQVersion.Version}(rocketmq-client:3.6.2.Final) ,
* to make sure all version exists in low-version rocketMQ-client-3.x
*/
public enum Version {
V3_0_0_SNAPSHOT,
V3_0_0_ALPHA1,
V3_0_0_BETA1,
V3_0_0_BETA2,
V3_0_0_BETA3,
V3_0_0_BETA4,
V3_0_0_BETA5,
V3_0_0_BETA6_SNAPSHOT,
V3_0_0_BETA6,
V3_0_0_BETA7_SNAPSHOT,
V3_0_0_BETA7,
V3_0_0_BETA8_SNAPSHOT,
V3_0_0_BETA8,
V3_0_0_BETA9_SNAPSHOT,
V3_0_0_BETA9,
V3_0_0_FINAL,
V3_0_1_SNAPSHOT,
V3_0_1,
V3_0_2_SNAPSHOT,
V3_0_2,
V3_0_3_SNAPSHOT,
V3_0_3,
V3_0_4_SNAPSHOT,
V3_0_4,
V3_0_5_SNAPSHOT,
V3_0_5,
V3_0_6_SNAPSHOT,
V3_0_6,
V3_0_7_SNAPSHOT,
V3_0_7,
V3_0_8_SNAPSHOT,
V3_0_8,
V3_0_9_SNAPSHOT,
V3_0_9,
V3_0_10_SNAPSHOT,
V3_0_10,
V3_0_11_SNAPSHOT,
V3_0_11,
V3_0_12_SNAPSHOT,
V3_0_12,
V3_0_13_SNAPSHO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HOT,
V3_9_6,
V3_9_7_SNAPSHOT,
V3_9_7,
V3_9_8_SNAPSHOT,
V3_9_8,
V3_9_9_SNAPSHOT,
V3_9_9;
private Version() {
}
}
\ No newline at end of file
......@@ -18,7 +18,6 @@
package org.apache.skywalking.apm.plugin.rocketMQ.v3.define;
import com.alibaba.rocketmq.common.MQVersion;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
......@@ -26,10 +25,9 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsIn
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import org.apache.skywalking.apm.plugin.rocketMQ.v3.MessageSendInterceptor;
import org.apache.skywalking.apm.plugin.rocketMQ.v3.Version;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import static org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
......@@ -58,8 +56,7 @@ public class MQClientAPIImplInstrumentation extends ClassInstanceMethodsEnhanceP
return new InstanceMethodsInterceptPoint[] {
new InstanceMethodsInterceptPoint() {
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
int argumentsLength = getArgumentsLength();
return named(SEND_MESSAGE_METHOD_NAME).and(takesArguments(argumentsLength));
return named(SEND_MESSAGE_METHOD_NAME).and(takesArgumentWithType(6, "com.alibaba.rocketmq.client.producer.SendCallback"));
}
@Override public String getMethodsInterceptor() {
......@@ -86,20 +83,8 @@ public class MQClientAPIImplInstrumentation extends ClassInstanceMethodsEnhanceP
};
}
@Override protected ClassMatch enhanceClass() {
return byName(ENHANCE_CLASS);
}
private int getArgumentsLength() {
if (MQVersion.CurrentVersion <= Version.V3_4_6.ordinal()) {
return 7;
} else if (MQVersion.CurrentVersion <= Version.V3_5_5.ordinal()) {
return 11;
}
return 12;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册