-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[type:feature] support dubbo protobuf serialization
- Loading branch information
Showing
13 changed files
with
329 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...apache/shenyu/examples/apache/dubbo/service/annotation/impl/DubboProtobufServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.shenyu.examples.apache.dubbo.service.annotation.impl; | ||
|
||
import com.google.protobuf.Empty; | ||
import org.apache.dubbo.config.annotation.DubboService; | ||
import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient; | ||
import org.apache.shenyu.examples.dubbo.api.service.DubboProtobufService; | ||
import org.apache.shenyu.examples.dubbo.api.service.DubboTestProtobuf; | ||
|
||
@DubboService(serialization = "protobuf") | ||
@ShenyuDubboClient(value = "/protobufSerialization") | ||
public class DubboProtobufServiceImpl implements DubboProtobufService { | ||
|
||
@ShenyuDubboClient("/insert") | ||
@Override | ||
public DubboTestProtobuf insert(final DubboTestProtobuf request) { | ||
return request; | ||
} | ||
|
||
@ShenyuDubboClient("/update") | ||
@Override | ||
public Empty update(final DubboTestProtobuf request) { | ||
return Empty.getDefaultInstance(); | ||
} | ||
|
||
@ShenyuDubboClient("/findOne") | ||
@Override | ||
public DubboTestProtobuf findOne(final Empty request) { | ||
return DubboTestProtobuf.newBuilder().setId("1").setName("test1").build(); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...va/org/apache/shenyu/examples/apache/dubbo/service/xml/impl/DubboProtobufServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.shenyu.examples.apache.dubbo.service.xml.impl; | ||
|
||
import com.google.protobuf.Empty; | ||
import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient; | ||
import org.apache.shenyu.examples.dubbo.api.service.DubboProtobufService; | ||
import org.apache.shenyu.examples.dubbo.api.service.DubboTestProtobuf; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service("dubboProtobufService") | ||
@ShenyuDubboClient(value = "/protobufSerialization") | ||
public class DubboProtobufServiceImpl implements DubboProtobufService { | ||
|
||
@ShenyuDubboClient("/insert") | ||
@Override | ||
public DubboTestProtobuf insert(final DubboTestProtobuf request) { | ||
return request; | ||
} | ||
|
||
@ShenyuDubboClient("/update") | ||
@Override | ||
public Empty update(final DubboTestProtobuf request) { | ||
return Empty.getDefaultInstance(); | ||
} | ||
|
||
@ShenyuDubboClient("/findOne") | ||
@Override | ||
public DubboTestProtobuf findOne(final Empty request) { | ||
return DubboTestProtobuf.newBuilder().setId("1").setName("test1").build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...n/java/org/apache/shenyu/examples/apache/dubbo/service/impl/DubboProtobufServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.shenyu.examples.apache.dubbo.service.impl; | ||
|
||
import com.google.protobuf.Empty; | ||
import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient; | ||
import org.apache.shenyu.examples.dubbo.api.service.DubboProtobufService; | ||
import org.apache.shenyu.examples.dubbo.api.service.DubboTestProtobuf; | ||
import org.springframework.stereotype.Service; | ||
|
||
@ShenyuDubboClient(value = "/protobufSerialization") | ||
@Service("dubboProtobufService") | ||
public class DubboProtobufServiceImpl implements DubboProtobufService { | ||
|
||
@ShenyuDubboClient("/insert") | ||
@Override | ||
public DubboTestProtobuf insert(final DubboTestProtobuf request) { | ||
return request; | ||
} | ||
|
||
@ShenyuDubboClient("/update") | ||
@Override | ||
public Empty update(final DubboTestProtobuf request) { | ||
return Empty.getDefaultInstance(); | ||
} | ||
|
||
@ShenyuDubboClient("/findOne") | ||
@Override | ||
public DubboTestProtobuf findOne(final Empty request) { | ||
return DubboTestProtobuf.newBuilder().setId("1").setName("test1").build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...mples/shenyu-examples-dubbo/shenyu-examples-dubbo-api/src/main/proto/DubboTestProto.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* 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. | ||
* | ||
*/ | ||
|
||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.apache.shenyu.examples.dubbo.api.service"; | ||
package DubboTestProtobuf; | ||
|
||
import "google/protobuf/empty.proto"; | ||
|
||
message DubboTestProtobuf { | ||
string id = 1; | ||
string name = 2; | ||
} | ||
|
||
service DubboProtobufService { | ||
rpc insert(DubboTestProtobuf) returns (DubboTestProtobuf) {} | ||
|
||
rpc findOne(google.protobuf.Empty) returns (DubboTestProtobuf) {} | ||
|
||
rpc update(DubboTestProtobuf) returns (google.protobuf.Empty) {} | ||
} |
Oops, something went wrong.