Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix-sample
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mall
arch
matrix-sample
Commits
fcf0e5f4
Commit
fcf0e5f4
authored
Feb 06, 2020
by
QIANGLU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dubbo demo
parent
c7f701ab
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
172 additions
and
43 deletions
+172
-43
pom.xml
spring-boot-dubbo/consumer/pom.xml
+35
-2
ConsumerStartup.java
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/ConsumerStartup.java
+5
-3
ConusmerController.java
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/controller/ConusmerController.java
+7
-5
ConsumerService.java
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/service/ConsumerService.java
+2
-0
ConsumerServiceImpl.java
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/service/ConsumerServiceImpl.java
+15
-1
application.yml
spring-boot-dubbo/consumer/src/main/resources/application.yml
+14
-3
pom.xml
spring-boot-dubbo/dubbo-api/pom.xml
+3
-7
DemoService.java
spring-boot-dubbo/dubbo-api/src/main/java/com/matrix/dubbo/api/DemoService.java
+3
-1
pom.xml
spring-boot-dubbo/pom.xml
+10
-12
pom.xml
spring-boot-dubbo/provider/pom.xml
+33
-2
EmbeddedZooKeeper.java
spring-boot-dubbo/provider/src/main/java/com/matrix/dubbo/provider/EmbeddedZooKeeper.java
+1
-1
ProviderStartup.java
spring-boot-dubbo/provider/src/main/java/com/matrix/dubbo/provider/ProviderStartup.java
+14
-4
DemoProviderServiceImpl.java
spring-boot-dubbo/provider/src/main/java/com/matrix/dubbo/provider/service/DemoProviderServiceImpl.java
+13
-1
application.yml
spring-boot-dubbo/provider/src/main/resources/application.yml
+17
-1
No files found.
spring-boot-dubbo/consumer/pom.xml
View file @
fcf0e5f4
...
@@ -10,6 +10,39 @@
...
@@ -10,6 +10,39 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
consumer
</artifactId>
<artifactId>
consumer
</artifactId>
<properties>
<revision>
2.7.5
</revision>
</properties>
<dependencies>
<dependency>
<groupId>
com.matrix
</groupId>
<artifactId>
dubbo-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-spring-boot-starter
</artifactId>
<version>
2.7.5
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
<version>
2.7.5
</version>
</dependency>
<!-- Zookeeper dependencies -->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-dependencies-zookeeper
</artifactId>
<version>
2.7.5
</version>
<type>
pom
</type>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
</project>
\ No newline at end of file
\ No newline at end of file
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/ConsumerStartup.java
View file @
fcf0e5f4
package
com
.
matrix
.
grpc
;
package
com
.
matrix
.
dubbo
.
consumer
;
import
org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
@@ -8,11 +9,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
...
@@ -8,11 +9,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author qianglu
* @author qianglu
*/
*/
@SpringBootApplication
@SpringBootApplication
public
class
PureStartup
{
@EnableDubboConfig
public
class
ConsumerStartup
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Pure
Startup
.
class
,
args
);
SpringApplication
.
run
(
Consumer
Startup
.
class
,
args
);
}
}
}
}
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/controller/ConusmerController.java
View file @
fcf0e5f4
package
com
.
matrix
.
dubbo
.
provid
er
.
controller
;
package
com
.
matrix
.
dubbo
.
consum
er
.
controller
;
import
com.matrix.dubbo.api.DemoService
;
import
com.matrix.dubbo.api.DemoService
;
import
com.matrix.dubbo.consumer.service.ConsumerService
;
import
com.matrix.dubbo.consumer.service.ConsumerServiceImpl
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -13,14 +15,14 @@ import javax.annotation.Resource;
...
@@ -13,14 +15,14 @@ import javax.annotation.Resource;
* @Version 1.0
* @Version 1.0
*/
*/
@RestController
@RestController
@RequestMapping
(
"/
provid
er"
)
@RequestMapping
(
"/
consum
er"
)
public
class
Demo
Controller
{
public
class
Conusmer
Controller
{
@Resource
@Resource
private
DemoService
demo
Service
;
private
ConsumerService
consumer
Service
;
@RequestMapping
(
"/demo"
)
@RequestMapping
(
"/demo"
)
public
String
getDemo
()
{
public
String
getDemo
()
{
return
demoService
.
getDemo
();
return
consumerService
.
getConsumer
();
}
}
}
}
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/service/ConsumerService.java
View file @
fcf0e5f4
...
@@ -7,4 +7,6 @@ package com.matrix.dubbo.consumer.service;
...
@@ -7,4 +7,6 @@ package com.matrix.dubbo.consumer.service;
* @Version 1.0
* @Version 1.0
*/
*/
public
interface
ConsumerService
{
public
interface
ConsumerService
{
public
String
getConsumer
();
}
}
spring-boot-dubbo/consumer/src/main/java/com/matrix/dubbo/consumer/service/ConsumerServiceImpl.java
View file @
fcf0e5f4
package
com
.
matrix
.
dubbo
.
consumer
.
service
;
package
com
.
matrix
.
dubbo
.
consumer
.
service
;
import
com.matrix.dubbo.api.DemoService
;
import
org.apache.dubbo.config.annotation.Reference
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
/**
/**
* @ClassName ConsumerService
* @ClassName ConsumerService
* @Author QIANGLU
* @Author QIANGLU
* @Date 2020/2/4 4:03 下午
* @Date 2020/2/4 4:03 下午
* @Version 1.0
* @Version 1.0
*/
*/
public
class
ConsumerService
{
@Service
public
class
ConsumerServiceImpl
implements
ConsumerService
{
@Reference
(
version
=
"${demo.service.version}"
,
check
=
false
)
private
DemoService
demoService
;
@Override
public
String
getConsumer
()
{
return
demoService
.
getDemo
();
}
}
}
spring-boot-dubbo/consumer/src/main/resources/application.yml
View file @
fcf0e5f4
spring
:
spring
:
application
:
application
:
name
:
learn-pure
name
:
consumer
server
:
server
:
port
:
6080
port
:
6081
dubbo
:
protocol
:
name
:
dubbo
port
:
11135
registry
:
address
:
zookeeper://127.0.0.1:2181
scan
:
base-packages
:
com.matrix.dubbo
demo
:
service
:
version
:
1.0
\ No newline at end of file
spring-boot-dubbo/dubbo-api/pom.xml
View file @
fcf0e5f4
...
@@ -2,14 +2,9 @@
...
@@ -2,14 +2,9 @@
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
spring-boot-dubbo
</artifactId>
<groupId>
com.nova
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.matrix
</groupId>
<artifactId>
dubbo-api
</artifactId>
<artifactId>
dubbo-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</project>
</project>
\ No newline at end of file
spring-boot-dubbo/dubbo-api/src/main/java/com/matrix/dubbo/api/DemoService.java
View file @
fcf0e5f4
...
@@ -6,5 +6,7 @@ package com.matrix.dubbo.api;
...
@@ -6,5 +6,7 @@ package com.matrix.dubbo.api;
* @Date 2020/2/4 3:30 下午
* @Date 2020/2/4 3:30 下午
* @Version 1.0
* @Version 1.0
*/
*/
public
class
DemoService
{
public
interface
DemoService
{
String
getDemo
();
}
}
spring-boot-dubbo/pom.xml
View file @
fcf0e5f4
...
@@ -6,7 +6,13 @@
...
@@ -6,7 +6,13 @@
<groupId>
com.nova
</groupId>
<groupId>
com.nova
</groupId>
<artifactId>
spring-boot-dubbo
</artifactId>
<artifactId>
spring-boot-dubbo
</artifactId>
<packaging>
pom
</packaging>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
<modules>
<module>
consumer
</module>
<module>
provider
</module>
<module>
dubbo-api
</module>
</modules>
<parent>
<parent>
<artifactId>
matrix
</artifactId>
<artifactId>
matrix
</artifactId>
...
@@ -16,25 +22,17 @@
...
@@ -16,25 +22,17 @@
<properties>
<properties>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
<dubbo.version>
2.7.0
</dubbo.version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
logger-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-dubbo/provider/pom.xml
View file @
fcf0e5f4
...
@@ -2,14 +2,44 @@
...
@@ -2,14 +2,44 @@
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<parent>
<artifactId>
spring-boot-dubbo
</artifactId>
<artifactId>
spring-boot-dubbo
</artifactId>
<groupId>
com.nova
</groupId>
<groupId>
com.nova
</groupId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
provider
</artifactId>
<artifactId>
provider
</artifactId>
<dependencies>
<dependency>
<groupId>
com.matrix
</groupId>
<artifactId>
dubbo-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-spring-boot-starter
</artifactId>
<version>
2.7.5
</version>
</dependency>
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
<version>
2.7.5
</version>
</dependency>
<!-- Zookeeper dependencies -->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo-dependencies-zookeeper
</artifactId>
<version>
2.7.5
</version>
<type>
pom
</type>
<exclusions>
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
</project>
\ No newline at end of file
spring-boot-dubbo/provider/src/main/java/com/matrix/dubbo/provider/EmbeddedZooKeeper.java
View file @
fcf0e5f4
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
package
org
.
apache
.
dubbo
.
spring
.
boot
.
demo
.
provider
.
bootstrap
;
package
com
.
matrix
.
dubbo
.
provider
;
import
org.apache.zookeeper.server.ServerConfig
;
import
org.apache.zookeeper.server.ServerConfig
;
...
...
spring-boot-dubbo/provider/src/main/java/com/matrix/dubbo/provider/ProviderStartup.java
View file @
fcf0e5f4
package
com
.
matrix
.
dubbo
.
consum
er
;
package
com
.
matrix
.
dubbo
.
provid
er
;
import
org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.core.env.Environment
;
/**
/**
* @author qianglu
* @author qianglu
*/
*/
@SpringBootApplication
@SpringBootApplication
public
class
ConsumerStartup
{
@EnableDubboConfig
public
class
ProviderStartup
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ConsumerStartup
.
class
,
args
);
new
SpringApplicationBuilder
(
ProviderStartup
.
class
)
.
listeners
((
ApplicationListener
<
ApplicationEnvironmentPreparedEvent
>)
event
->
{
Environment
environment
=
event
.
getEnvironment
();
new
EmbeddedZooKeeper
(
2181
,
false
).
start
();
})
.
run
(
args
);
}
}
}
}
spring-boot-dubbo/provider/src/main/java/com/matrix/dubbo/provider/service/DemoProviderServiceImpl.java
View file @
fcf0e5f4
package
com
.
matrix
.
dubbo
.
provider
.
service
;
package
com
.
matrix
.
dubbo
.
provider
.
service
;
import
com.matrix.dubbo.api.DemoService
;
import
org.apache.dubbo.config.annotation.Service
;
import
javax.annotation.Resource
;
/**
/**
* @ClassName DemoServiceImpl
* @ClassName DemoServiceImpl
* @Author QIANGLU
* @Author QIANGLU
* @Date 2020/2/4 3:29 下午
* @Date 2020/2/4 3:29 下午
* @Version 1.0
* @Version 1.0
*/
*/
public
class
DemoServiceImpl
{
@Service
(
version
=
"1.0"
)
public
class
DemoProviderServiceImpl
implements
DemoService
{
@Override
public
String
getDemo
()
{
return
"this is provider"
;
}
}
}
spring-boot-dubbo/provider/src/main/resources/application.yml
View file @
fcf0e5f4
spring
:
spring
:
application
:
application
:
name
:
consum
er
name
:
provid
er
server
:
server
:
port
:
6080
port
:
6080
dubbo
:
protocol
:
name
:
dubbo
port
:
11134
registry
:
address
:
zookeeper://127.0.0.1:2181
scan
:
base-packages
:
com.matrix.dubbo.provider.service
demo
:
service
:
version
:
1.0
embedded
:
zookeeper
:
port
:
2181
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment