You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "11huangxing (via GitHub)" <gi...@apache.org> on 2023/03/13 09:10:25 UTC

[GitHub] [dubbo] 11huangxing opened a new issue, #11809: dubbo 31.7版本中如何设置ReferenceBean的ip、port、interface、group、payload

11huangxing opened a new issue, #11809:
URL: https://github.com/apache/dubbo/issues/11809

   我项目原来使用的是2.7.19版本,因为要修复序列化的安全问题现在要升级到3.1.7版本;项目中使用了ReferenceBean设置ip、port、interface、group,现在3.1.7中没有这些api直接设置了,无法直接上这个版本,来此求助,希望大神帮忙
   


-- 
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: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] 11huangxing commented on issue #11809: dubbo 31.7版本中如何设置ReferenceBean的url、interface、group、payload

Posted by "11huangxing (via GitHub)" <gi...@apache.org>.
11huangxing commented on issue #11809:
URL: https://github.com/apache/dubbo/issues/11809#issuecomment-1467251884

   > You can create a ReferenceBean by chaining through ReferenceBeanBuilder, which can meet your needs of taking me with you.
   
   Thank you very much for providing me with the solution by ReferenceBeanBuilder,I first created a ReferenceBeanBuilder object, and then set the url, timeout, and group properties,Finally, execute beanBuilder. build (); Is this way OK?
   I have a few small questions,How to set payload and obtain a dubboService object in version 3.1.7,
   This is the previous code:
   ![image](https://user-images.githubusercontent.com/127729798/224876667-79c76862-1c24-4265-80c7-ebdab12a737f.png)
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] 11huangxing commented on issue #11809: dubbo 31.7版本中如何设置ReferenceBean的ip、port、interface、group、payload

Posted by "11huangxing (via GitHub)" <gi...@apache.org>.
11huangxing commented on issue #11809:
URL: https://github.com/apache/dubbo/issues/11809#issuecomment-1465767974

   这是之前的代码:
   T service = (T)dubboServiceCache.computeIfAbsent(cacheKey, k -> {
               log.debug("dubbo service not exist, ready to get one.");
               ReferenceBean<T> referenceBean = new ReferenceBean<>();
               referenceBean.setApplicationContext(applicationContext);
               referenceBean.setInterface(serviceClass);
               if (timeout != null)
               {
                   referenceBean.setTimeout(timeout);
               }
   
               if (StringUtils.isNotBlank(group))
               {
                   referenceBean.setGroup(group);
               }
               if (StringUtils.isNotBlank(ip) && port > 0)
               {
                   referenceBean.setUrl("dubbo://" + ip + ":" + port);
               }
   
               ProtocolConfig protocolConfig = getBean(ProtocolConfig.class);
               if (protocolConfig.getPayload() != null)
               {
                   Map<String, String> refParams = referenceBean.getParameters();
                   if (null == refParams)
                   {
                       refParams = new HashMap<>();
                   }
   
                   refParams.put(Constants.PAYLOAD_KEY, protocolConfig.getPayload().toString());
                   log.debug("magic set reference config parameters: {}", refParams);
                   referenceBean.setParameters(refParams);
               }


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] MieAh commented on issue #11809: dubbo 31.7版本中如何设置ReferenceBean的url、interface、group、payload

Posted by "MieAh (via GitHub)" <gi...@apache.org>.
MieAh commented on issue #11809:
URL: https://github.com/apache/dubbo/issues/11809#issuecomment-1467270550

   Yes.You can configure the payload through ReferenceBeanBuidler#setParameters.The obtain a dubboService object operation is ReferenceBean#getObject.You can look at the source code, which may enhance your use of this area


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] MieAh commented on issue #11809: dubbo 31.7版本中如何设置ReferenceBean的url、interface、group、payload

Posted by "MieAh (via GitHub)" <gi...@apache.org>.
MieAh commented on issue #11809:
URL: https://github.com/apache/dubbo/issues/11809#issuecomment-1466613691

   You can create a ReferenceBean by chaining through ReferenceBeanBuilder, which can meet your needs of taking me with you.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] 11huangxing closed issue #11809: dubbo 31.7版本中如何设置ReferenceBean的url、interface、group、payload

Posted by "11huangxing (via GitHub)" <gi...@apache.org>.
11huangxing closed issue #11809: dubbo 31.7版本中如何设置ReferenceBean的url、interface、group、payload
URL: https://github.com/apache/dubbo/issues/11809


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org