Skip to content

Commit

Permalink
Update: pom config
Browse files Browse the repository at this point in the history
  • Loading branch information
shichaoyang committed Sep 26, 2024
1 parent 805eefc commit abc0738
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 87 deletions.
21 changes: 2 additions & 19 deletions joylive-demo/joylive-demo-grpc/joylive-demo-grpc-consumer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<artifactId>joylive-demo-grpc</artifactId>
<version>${revision}</version>
</parent>

<artifactId>joylive-demo-grpc-consumer</artifactId>

<properties>
<grpc-all.version>1.60.0</grpc-all.version>
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
<spring.cloud.version>Hoxton.SR1</spring.cloud.version>
<grpc-all.version>1.29.0</grpc-all.version>
<spring.cloud.alibaba.version>2.2.0.RELEASE</spring.cloud.alibaba.version>
<grpc.spring.cloud.version>2.8.0.RELEASE</grpc.spring.cloud.version>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -41,12 +42,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
<version>${grpc-all.version}</version>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -58,18 +53,6 @@
<version>${revision}</version>
</dependency>

<!-- gRpc -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.60.0</version>
</dependency>

<!-- 实现对 SpringMVC 的自动化配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
<spring.cloud.version>Hoxton.SR1</spring.cloud.version>
<grpc-all.version>1.60.0</grpc-all.version>
<grpc-all.version>1.29.0</grpc-all.version>
<spring.cloud.alibaba.version>2.2.0.RELEASE</spring.cloud.alibaba.version>
<grpc.spring.cloud.version>2.8.0.RELEASE</grpc.spring.cloud.version>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
/*
* Copyright © ${year} ${owner} (${email})
*
* Licensed 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 com.jd.live.agent.plugin.router.gprc.definition;

import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
//import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
//import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
import com.jd.live.agent.core.extension.annotation.Extension;
import com.jd.live.agent.core.inject.annotation.Inject;
import com.jd.live.agent.core.inject.annotation.Injectable;
import com.jd.live.agent.core.parser.ObjectParser;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
//import com.jd.live.agent.governance.config.GovernanceConfig;
import com.jd.live.agent.governance.invoke.InvocationContext;
import com.jd.live.agent.plugin.router.gprc.interceptor.ClusterInterceptor;

@Injectable
@Extension(value = "GrpcClusterDefinition")
//@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
//@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SOFARPC_ENABLED, matchIfMissing = true)
//@ConditionalOnClass(ClusterDefinition.TYPE_ABSTRACT_CLUSTER)
public class ClusterDefinition extends PluginDefinitionAdapter {

protected static final String TYPE_ABSTRACT_CLUSTER = "com.alipay.sofa.rpc.client.AbstractCluster";

private static final String METHOD_DO_INVOKE = "doInvoke";

private static final String[] ARGUMENT_DO_INVOKE = new String[]{
"com.alipay.sofa.rpc.core.request.SofaRequest"
};

@Inject(InvocationContext.COMPONENT_INVOCATION_CONTEXT)
private InvocationContext context;

@Inject(ObjectParser.JSON)
private ObjectParser parser;

public ClusterDefinition() {
System.out.println("----> ClusterDefinition");
this.matcher = () -> MatcherBuilder.isSubTypeOf(TYPE_ABSTRACT_CLUSTER)
.and(MatcherBuilder.not(MatcherBuilder.isAbstract()));
this.interceptors = new InterceptorDefinition[]{
new InterceptorDefinitionAdapter(
MatcherBuilder.named(METHOD_DO_INVOKE)
.and(MatcherBuilder.arguments(ARGUMENT_DO_INVOKE)),
() -> new ClusterInterceptor(context, parser)
)
};
}

}
///*
// * Copyright © ${year} ${owner} (${email})
// *
// * Licensed 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 com.jd.live.agent.plugin.router.gprc.definition;
//
//import com.jd.live.agent.core.bytekit.matcher.MatcherBuilder;
////import com.jd.live.agent.core.extension.annotation.ConditionalOnClass;
////import com.jd.live.agent.core.extension.annotation.ConditionalOnProperty;
//import com.jd.live.agent.core.extension.annotation.Extension;
//import com.jd.live.agent.core.inject.annotation.Inject;
//import com.jd.live.agent.core.inject.annotation.Injectable;
//import com.jd.live.agent.core.parser.ObjectParser;
//import com.jd.live.agent.core.plugin.definition.InterceptorDefinition;
//import com.jd.live.agent.core.plugin.definition.InterceptorDefinitionAdapter;
//import com.jd.live.agent.core.plugin.definition.PluginDefinitionAdapter;
////import com.jd.live.agent.governance.config.GovernanceConfig;
//import com.jd.live.agent.governance.invoke.InvocationContext;
//import com.jd.live.agent.plugin.router.gprc.interceptor.ClusterInterceptor;
//
//@Injectable
//@Extension(value = "GrpcClusterDefinition")
////@ConditionalOnProperty(name = GovernanceConfig.CONFIG_FLOW_CONTROL_ENABLED, matchIfMissing = true)
////@ConditionalOnProperty(name = GovernanceConfig.CONFIG_LIVE_SOFARPC_ENABLED, matchIfMissing = true)
////@ConditionalOnClass(ClusterDefinition.TYPE_ABSTRACT_CLUSTER)
//public class ClusterDefinition extends PluginDefinitionAdapter {
//
// protected static final String TYPE_ABSTRACT_CLUSTER = "com.alipay.sofa.rpc.client.AbstractCluster";
//
// private static final String METHOD_DO_INVOKE = "doInvoke";
//
// private static final String[] ARGUMENT_DO_INVOKE = new String[]{
// "com.alipay.sofa.rpc.core.request.SofaRequest"
// };
//
// @Inject(InvocationContext.COMPONENT_INVOCATION_CONTEXT)
// private InvocationContext context;
//
// @Inject(ObjectParser.JSON)
// private ObjectParser parser;
//
// public ClusterDefinition() {
// System.out.println("----> ClusterDefinition");
// this.matcher = () -> MatcherBuilder.isSubTypeOf(TYPE_ABSTRACT_CLUSTER)
// .and(MatcherBuilder.not(MatcherBuilder.isAbstract()));
// this.interceptors = new InterceptorDefinition[]{
// new InterceptorDefinitionAdapter(
// MatcherBuilder.named(METHOD_DO_INVOKE)
// .and(MatcherBuilder.arguments(ARGUMENT_DO_INVOKE)),
// () -> new ClusterInterceptor(context, parser)
// )
// };
// }
//
//}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
com.jd.live.agent.plugin.router.gprc.definition.ClusterDefinition
#com.jd.live.agent.plugin.router.gprc.definition.ClusterDefinition
com.jd.live.agent.plugin.router.gprc.definition.GrpcClientCallDefinition

0 comments on commit abc0738

Please sign in to comment.