dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

injvm and local call

Open beiwei30 opened this issue 7 years ago • 5 comments

injvm protocol doesn't work well with scope.

injvm should not be registered to register center

<dubbo:protocol name="injvm"/>
<bean id="target" class="org.apache.dubbo.samples.provider.GreetingsServiceImpl"/>
<dubbo:service interface="org.apache.dubbo.samples.api.GreetingsService" ref="target" protocol="injvm"/>

injvm url is registered

local call doesn't work when protocol is injvm

The following configuration is supposed to work but dubbo complains no provider found from registry center.

<dubbo:protocol name="injvm"/>
<bean id="target" class="org.apache.dubbo.samples.provider.GreetingsServiceImpl"/>
<dubbo:service interface="org.apache.dubbo.samples.api.GreetingsService" ref="target" scope="local" protocol="injvm"/>
<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.api.GreetingsService" scope="local"/>

beiwei30 avatar Mar 12 '19 08:03 beiwei30

I try to reproduce the problem with your config, but it fails.

lkj41110 avatar Apr 09 '19 12:04 lkj41110

I reproduced your problem and made changes to the injvm export.Will submit a pr fix this bug in the near future

Leishunyu avatar Apr 11 '19 12:04 Leishunyu

I am not sure what is the best way to fix this issue.

In a real scene, I think we will use :

@Autowired
private GreetingsService target;
// remove this configuration
//<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.api.GreetingsService" //scope="local"/>

instead of:

@Autowired
private GreetingsService demoService;


<dubbo:reference id="demoService" interface="org.apache.dubbo.samples.api.GreetingsService" scope="local"/>

cvictory avatar May 06 '19 03:05 cvictory

This modification increase some complex logic and I suggest we donot fix this issue.

cvictory avatar May 06 '19 03:05 cvictory

I merged #3857 since it does solve the two problems I reported. Later we can consider removing 'injvm' and 'scope' from user's configuration entirely.

beiwei30 avatar May 06 '19 06:05 beiwei30