Skip to content

Commit 5b9adb0

Browse files
authored
Support for Mutiny Reactive (#15537)
1 parent a75de07 commit 5b9adb0

33 files changed

Lines changed: 2334 additions & 0 deletions

.artifacts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ dubbo-metrics-registry
5656
dubbo-metrics-config-center
5757
dubbo-metrics-netty
5858
dubbo-metrics-event
59+
dubbo-mutiny
5960
dubbo-native
6061
dubbo-parent
6162
dubbo-plugin

dubbo-dependencies-bom/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
<prometheus_client.version>0.16.0</prometheus_client.version>
131131
<reactive.version>1.0.4</reactive.version>
132132
<reactor.version>3.7.6</reactor.version>
133+
<mutiny.version>2.9.0</mutiny.version>
133134
<rxjava.version>2.2.21</rxjava.version>
134135
<okhttp_version>3.14.9</okhttp_version>
135136

@@ -966,6 +967,11 @@
966967
<artifactId>reactor-core</artifactId>
967968
<version>${reactor.version}</version>
968969
</dependency>
970+
<dependency>
971+
<groupId>io.smallrye.reactive</groupId>
972+
<artifactId>mutiny</artifactId>
973+
<version>${mutiny.version}</version>
974+
</dependency>
969975
<dependency>
970976
<groupId>io.reactivex.rxjava2</groupId>
971977
<artifactId>rxjava</artifactId>

dubbo-distribution/dubbo-all-shaded/pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@
512512
<include>org.apache.dubbo:dubbo-qos-api</include>
513513
<include>org.apache.dubbo:dubbo-security</include>
514514
<include>org.apache.dubbo:dubbo-reactive</include>
515+
<include>org.apache.dubbo:dubbo-mutiny</include>
515516
<include>org.apache.dubbo:dubbo-spring-security</include>
516517
<include>org.apache.dubbo:dubbo-spring6-security</include>
517518
<include>org.apache.dubbo:dubbo-registry-api</include>
@@ -1005,6 +1006,21 @@
10051006
</dependency>
10061007
</dependencies>
10071008
</profile>
1009+
<profile>
1010+
<id>reactive-mutiny</id>
1011+
<activation>
1012+
<jdk>[17,)</jdk>
1013+
</activation>
1014+
<dependencies>
1015+
<dependency>
1016+
<groupId>org.apache.dubbo</groupId>
1017+
<artifactId>dubbo-mutiny</artifactId>
1018+
<version>${project.version}</version>
1019+
<scope>compile</scope>
1020+
<optional>true</optional>
1021+
</dependency>
1022+
</dependencies>
1023+
</profile>
10081024
<profile>
10091025
<id>loom</id>
10101026
<activation>
@@ -1037,6 +1053,13 @@
10371053
<scope>compile</scope>
10381054
<optional>true</optional>
10391055
</dependency>
1056+
<dependency>
1057+
<groupId>org.apache.dubbo</groupId>
1058+
<artifactId>dubbo-mutiny</artifactId>
1059+
<version>${project.version}</version>
1060+
<scope>compile</scope>
1061+
<optional>true</optional>
1062+
</dependency>
10401063
</dependencies>
10411064
<build>
10421065
<plugins>

dubbo-distribution/dubbo-all/pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@
511511
<include>org.apache.dubbo:dubbo-qos-api</include>
512512
<include>org.apache.dubbo:dubbo-security</include>
513513
<include>org.apache.dubbo:dubbo-reactive</include>
514+
<include>org.apache.dubbo:dubbo-mutiny</include>
514515
<include>org.apache.dubbo:dubbo-spring-security</include>
515516
<include>org.apache.dubbo:dubbo-spring6-security</include>
516517
<include>org.apache.dubbo:dubbo-registry-api</include>
@@ -990,6 +991,21 @@
990991
</dependency>
991992
</dependencies>
992993
</profile>
994+
<profile>
995+
<id>reactive-mutiny</id>
996+
<activation>
997+
<jdk>[17,)</jdk>
998+
</activation>
999+
<dependencies>
1000+
<dependency>
1001+
<groupId>org.apache.dubbo</groupId>
1002+
<artifactId>dubbo-mutiny</artifactId>
1003+
<version>${project.version}</version>
1004+
<scope>compile</scope>
1005+
<optional>true</optional>
1006+
</dependency>
1007+
</dependencies>
1008+
</profile>
9931009
<profile>
9941010
<id>loom</id>
9951011
<activation>
@@ -1022,6 +1038,13 @@
10221038
<scope>compile</scope>
10231039
<optional>true</optional>
10241040
</dependency>
1041+
<dependency>
1042+
<groupId>org.apache.dubbo</groupId>
1043+
<artifactId>dubbo-mutiny</artifactId>
1044+
<version>${project.version}</version>
1045+
<scope>compile</scope>
1046+
<optional>true</optional>
1047+
</dependency>
10251048
</dependencies>
10261049
<build>
10271050
<plugins>

dubbo-distribution/dubbo-bom/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@
284284
<artifactId>dubbo-reactive</artifactId>
285285
<version>${project.version}</version>
286286
</dependency>
287+
<dependency>
288+
<groupId>org.apache.dubbo</groupId>
289+
<artifactId>dubbo-mutiny</artifactId>
290+
<version>${project.version}</version>
291+
</dependency>
287292

288293
<dependency>
289294
<groupId>org.apache.dubbo</groupId>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.dubbo.gen.tri.mutiny;
18+
19+
import org.apache.dubbo.gen.AbstractGenerator;
20+
import org.apache.dubbo.gen.DubboGeneratorPlugin;
21+
22+
public class MutinyDubbo3TripleGenerator extends AbstractGenerator {
23+
24+
public static void main(String[] args) {
25+
DubboGeneratorPlugin.generate(new MutinyDubbo3TripleGenerator());
26+
}
27+
28+
@Override
29+
protected String getClassPrefix() {
30+
return "Dubbo";
31+
}
32+
33+
@Override
34+
protected String getClassSuffix() {
35+
return "Triple";
36+
}
37+
38+
@Override
39+
protected String getTemplateFileName() {
40+
return "MutinyDubbo3TripleStub.mustache";
41+
}
42+
43+
@Override
44+
protected String getInterfaceTemplateFileName() {
45+
return "MutinyDubbo3TripleInterfaceStub.mustache";
46+
}
47+
48+
@Override
49+
protected String getSingleTemplateFileName() {
50+
throw new IllegalStateException("Do not support single template!");
51+
}
52+
53+
@Override
54+
protected boolean useMultipleTemplate(boolean multipleFiles) {
55+
return true;
56+
}
57+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
{{#packageName}}
19+
package {{packageName}};
20+
{{/packageName}}
21+
22+
import io.smallrye.mutiny.Multi;
23+
import io.smallrye.mutiny.Uni;
24+
25+
public interface {{interfaceClassName}} extends org.apache.dubbo.rpc.model.DubboStub {
26+
27+
String JAVA_SERVICE_NAME = "{{packageName}}.{{serviceName}}";
28+
{{#commonPackageName}}
29+
String SERVICE_NAME = "{{commonPackageName}}.{{serviceName}}";
30+
{{/commonPackageName}}
31+
{{^commonPackageName}}
32+
String SERVICE_NAME = "{{commonPackageName}}.{{serviceName}}";
33+
{{/commonPackageName}}
34+
{{#methods}}
35+
{{#javaDoc}}
36+
{{{javaDoc}}}
37+
{{/javaDoc}}
38+
{{#deprecated}}
39+
@java.lang.Deprecated
40+
{{/deprecated}}
41+
{{#isManyOutput}}Multi{{/isManyOutput}}{{^isManyOutput}}Uni{{/isManyOutput}}<{{outputType}}> {{methodName}}({{#isManyInput}}Multi{{/isManyInput}}{{^isManyInput}}Uni{{/isManyInput}}<{{inputType}}> mutinyRequest) ;
42+
43+
{{/methods}}
44+
}

0 commit comments

Comments
 (0)