fcabbage commented on issue #15880:
URL: https://github.com/apache/dubbo/issues/15880#issuecomment-3674412285
### Common
```
public interface UserService {
User getUserById(Long id);
}
@Data
public class User implements Serializable {
private Long id;
private String name;
}
```
### Provider
```
@DubboService(registry = "nacos", version = "default")
public class UserServiceImpl implements UserService {
@Override
public User getUserById(Long id) {
System.out.println(RpcContext.getServerContext().getUrl().getProtocol());
User user = new User();
user.setId(id);
user.setName(String.valueOf(id));
return user;
}
}
```
application.properties
```
dubbo.application.name=MyConsumer
dubbo.application.qosPort=22233
dubbo.registries.nacos.address=nacos://127.0.0.1:8848
dubbo.protocol.triple.max-frame-size=16777215
```
### Consumer
```
@RestController
@RequestMapping("/user")
public class UserController {
@DubboReference(registry = "nacos", version = "default", retries = 0,
timeout = 5000)
private UserService userService;
@GetMapping("/{id}")
public User getUserById(@PathVariable Long id) {
return userService.getUserById(id);
}
}
```
application.properties
```
dubbo.registries.nacos.address=nacos://127.0.0.1:8848
dubbo.registries.nacos.register-mode=instance
dubbo.protocol.triple.max-frame-size=16777215
dubbo.protocol.name=dubbo
dubbo.protocol.port=20880
dubbo.protocol.ext-protocol=tri
dubbo.protocol.preferred-protocol=tri
# New Infos:
# When I enable the following configuration, the protocol is tri;
# When disabled, it defaults to dubbo;
dubbo.protocol.payload=33554432
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]