Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
武汉红喜
whatsmars
提交
c5af1522
W
whatsmars
项目概览
武汉红喜
/
whatsmars
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c5af1522
编写于
12月 04, 2017
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dubbo生产实践
上级
6e90d82f
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
56 addition
and
96 deletion
+56
-96
whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/DemoService.java
...c/main/java/com/whatsmars/dubbo/demo/api/DemoService.java
+1
-1
whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/UserService.java
...c/main/java/com/whatsmars/dubbo/demo/api/UserService.java
+1
-1
whatsmars-dubbo/whatsmars-dubbo-consumer-boot/src/main/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
...n/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
+1
-1
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoAction.java
...in/java/com/whatsmars/dubbo/demo/consumer/DemoAction.java
+2
-11
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoConsumer.java
.../java/com/whatsmars/dubbo/demo/consumer/DemoConsumer.java
+1
-1
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-action.xml
...-consumer/src/main/resources/spring/dubbo-demo-action.xml
+4
-20
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-consumer.xml
...onsumer/src/main/resources/spring/dubbo-demo-consumer.xml
+3
-18
whatsmars-dubbo/whatsmars-dubbo-provider-boot/src/main/java/com/whatsmars/dubbo/demo/provider/resource/DemoServiceImpl.java
...atsmars/dubbo/demo/provider/resource/DemoServiceImpl.java
+1
-1
whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml
whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml
+5
-0
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/UserServiceImpl.java
...itlong/whatsmars/dubbo/demo/provider/UserServiceImpl.java
+0
-19
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoProvider.java
.../java/com/whatsmars/dubbo/demo/provider/DemoProvider.java
+1
-1
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
...va/com/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
+27
-0
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/spring/dubbo-demo-provider.xml
...rovider/src/main/resources/spring/dubbo-demo-provider.xml
+9
-22
未找到文件。
whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/
itlong/
whatsmars/dubbo/demo/api/DemoService.java
→
whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/DemoService.java
浏览文件 @
c5af1522
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.
itlong.
whatsmars.dubbo.demo.api
;
package
com.whatsmars.dubbo.demo.api
;
public
interface
DemoService
{
...
...
whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/
itlong/
whatsmars/dubbo/demo/api/UserService.java
→
whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/UserService.java
浏览文件 @
c5af1522
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.
itlong.
whatsmars.dubbo.demo.api
;
package
com.whatsmars.dubbo.demo.api
;
public
interface
UserService
{
...
...
whatsmars-dubbo/whatsmars-dubbo-consumer-boot/src/main/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
浏览文件 @
c5af1522
package
com.whatsmars.dubbo.demo.consumer.rpc
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.
itlong.
whatsmars.dubbo.demo.api.DemoService
;
import
com.whatsmars.dubbo.demo.api.DemoService
;
import
org.springframework.stereotype.Component
;
/**
...
...
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/
itlong/
whatsmars/dubbo/demo/consumer/DemoAction.java
→
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoAction.java
浏览文件 @
c5af1522
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.
itlong.
whatsmars.dubbo.demo.consumer
;
package
com.whatsmars.dubbo.demo.consumer
;
import
com.itlong.whatsmars.dubbo.demo.api.DemoService
;
import
com.itlong.whatsmars.dubbo.demo.api.UserService
;
import
com.whatsmars.dubbo.demo.api.DemoService
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
...
...
@@ -13,23 +12,15 @@ public class DemoAction {
private
DemoService
demoService
;
private
UserService
userService
;
public
void
setDemoService
(
DemoService
demoService
)
{
this
.
demoService
=
demoService
;
}
public
void
setUserService
(
UserService
userService
)
{
this
.
userService
=
userService
;
}
public
void
start
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
Integer
.
MAX_VALUE
;
i
++)
{
try
{
String
hello
=
demoService
.
sayHello
(
"world"
+
i
);
String
hi
=
userService
.
sayHi
(
"java"
+
i
);
System
.
out
.
println
(
"["
+
new
SimpleDateFormat
(
"HH:mm:ss"
).
format
(
new
Date
())
+
"] "
+
hello
);
System
.
out
.
println
(
"["
+
new
SimpleDateFormat
(
"HH:mm:ss"
).
format
(
new
Date
())
+
"] "
+
hi
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/
itlong/
whatsmars/dubbo/demo/consumer/DemoConsumer.java
→
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoConsumer.java
浏览文件 @
c5af1522
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.
itlong.
whatsmars.dubbo.demo.consumer
;
package
com.whatsmars.dubbo.demo.consumer
;
public
class
DemoConsumer
{
...
...
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-action.xml
浏览文件 @
c5af1522
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 Alibaba Group.
-
- Licensed 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.
-->
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"
>
<bean
class=
"com.
itlong.
whatsmars.dubbo.demo.consumer.DemoAction"
init-method=
"start"
>
<bean
class=
"com.whatsmars.dubbo.demo.consumer.DemoAction"
init-method=
"start"
>
<property
name=
"demoService"
ref=
"demoService"
/>
<property
name=
"userService"
ref=
"userService"
/>
</bean>
</beans>
\ No newline at end of file
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-consumer.xml
浏览文件 @
c5af1522
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 Alibaba Group.
-
- Licensed 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.
-->
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-
2.5
.xsd
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-
3.2
.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
<!--<!– 提供方应用信息,用于计算依赖关系 –>-->
...
...
@@ -25,7 +11,6 @@
<!--<!– 使用zookeeper注册中心暴露服务地址 –>-->
<!--<dubbo:registry address="zookeeper://127.0.0.1:2181" />-->
<dubbo:reference
id=
"demoService"
interface=
"com.itlong.whatsmars.dubbo.demo.api.DemoService"
/>
<dubbo:reference
id=
"userService"
interface=
"com.itlong.whatsmars.dubbo.demo.api.UserService"
/>
<dubbo:reference
id=
"demoService"
interface=
"com.whatsmars.dubbo.demo.api.DemoService"
/>
</beans>
\ No newline at end of file
whatsmars-dubbo/whatsmars-dubbo-provider-boot/src/main/java/com/whatsmars/dubbo/demo/provider/resource/DemoServiceImpl.java
浏览文件 @
c5af1522
...
...
@@ -5,7 +5,7 @@ package com.whatsmars.dubbo.demo.provider.resource;
import
com.alibaba.dubbo.config.annotation.Service
;
import
com.alibaba.dubbo.rpc.RpcContext
;
import
com.
itlong.
whatsmars.dubbo.demo.api.DemoService
;
import
com.whatsmars.dubbo.demo.api.DemoService
;
import
com.whatsmars.dubbo.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml
浏览文件 @
c5af1522
...
...
@@ -43,6 +43,11 @@
<artifactId>
zkclient
</artifactId>
<version>
0.9
</version>
</dependency>
<dependency>
<groupId>
com.itlong
</groupId>
<artifactId>
whatsmars-dubbo-service
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
...
...
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/UserServiceImpl.java
已删除
100644 → 0
浏览文件 @
6e90d82f
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.itlong.whatsmars.dubbo.demo.provider
;
import
com.alibaba.dubbo.rpc.RpcContext
;
import
com.itlong.whatsmars.dubbo.demo.api.UserService
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
UserServiceImpl
implements
UserService
{
public
String
sayHi
(
String
name
)
{
System
.
out
.
println
(
"["
+
new
SimpleDateFormat
(
"HH:mm:ss"
).
format
(
new
Date
())
+
"] Hi "
+
name
+
", request from consumer: "
+
RpcContext
.
getContext
().
getRemoteAddress
());
return
"Hi "
+
name
+
", response form provider: "
+
RpcContext
.
getContext
().
getLocalAddress
();
}
}
\ No newline at end of file
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/
itlong/
whatsmars/dubbo/demo/provider/DemoProvider.java
→
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoProvider.java
浏览文件 @
c5af1522
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.
itlong.
whatsmars.dubbo.demo.provider
;
package
com.whatsmars.dubbo.demo.provider
;
import
java.io.IOException
;
...
...
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/
itlong/
whatsmars/dubbo/demo/provider/DemoServiceImpl.java
→
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
浏览文件 @
c5af1522
/**
* Created by shenhongxi on 2017/6/21.
*/
package
com.
itlong.
whatsmars.dubbo.demo.provider
;
package
com.whatsmars.dubbo.demo.provider
;
import
com.alibaba.dubbo.rpc.RpcContext
;
import
com.itlong.whatsmars.dubbo.demo.api.DemoService
;
import
com.whatsmars.dubbo.demo.api.DemoService
;
import
com.whatsmars.dubbo.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
@Service
(
"demoService"
)
public
class
DemoServiceImpl
implements
DemoService
{
@Autowired
private
UserService
userService
;
public
String
sayHello
(
String
name
)
{
boolean
registerSuccess
=
userService
.
register
(
name
);
System
.
out
.
println
(
"["
+
new
SimpleDateFormat
(
"HH:mm:ss"
).
format
(
new
Date
())
+
"] Hello "
+
name
+
", request from consumer: "
+
RpcContext
.
getContext
().
getRemoteAddress
());
return
"Hello "
+
name
+
", response form provider: "
+
RpcContext
.
getContext
().
getLocalAddress
();
return
"Hello "
+
name
+
", re
gisterSuccess:"
+
registerSuccess
+
", re
sponse form provider: "
+
RpcContext
.
getContext
().
getLocalAddress
();
}
}
\ No newline at end of file
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/spring/dubbo-demo-provider.xml
浏览文件 @
c5af1522
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2011 Alibaba Group.
-
- Licensed 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.
-->
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:dubbo=
"http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
default-autowire=
"byName"
>
<!--<!– 提供方应用信息,用于计算依赖关系 –>-->
<!--<dubbo:application name="whatsmars_provider" />-->
...
...
@@ -26,11 +15,9 @@
<!--<dubbo:registry address="zookeeper://127.0.0.1:2181" />-->
<!--<!– 用dubbo协议在20880端口暴露服务 –>-->
<!--<dubbo:protocol name="dubbo" port="20880" />-->
<bean
id=
"demoService"
class=
"com.itlong.whatsmars.dubbo.demo.provider.DemoServiceImpl"
/>
<bean
id=
"userService"
class=
"com.itlong.whatsmars.dubbo.demo.provider.UserServiceImpl"
/>
<dubbo:service
interface=
"com.itlong.whatsmars.dubbo.demo.api.DemoService"
ref=
"demoService"
/>
<dubbo:service
interface=
"com.itlong.whatsmars.dubbo.demo.api.UserService"
ref=
"userService"
/>
<context:component-scan
base-package=
"com.whatsmars.dubbo"
/>
<dubbo:service
interface=
"com.whatsmars.dubbo.demo.api.DemoService"
ref=
"demoService"
/>
</beans>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录