Skip to content

Commit f62f973

Browse files
authored
Merge pull request #78 from codingapi/dev
update version and event support global handler & handler order
2 parents b2846ca + bfa2715 commit f62f973

File tree

18 files changed

+133
-72
lines changed

18 files changed

+133
-72
lines changed

example/example-application/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.5</version>
8+
<version>3.3.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-application/src/main/java/com/codingapi/example/handler/CHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void handler(CEvent event) {
1515
log.info("c event:{},eventKey:{}", event, EventTraceContext.getInstance().getEventKey());
1616

1717
// EventPusher.push(new AEvent());
18-
throw new RuntimeException("c handler error");
18+
// throw new RuntimeException("c handler error");
1919
}
2020

2121
@Override
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.codingapi.example.handler;
2+
3+
import com.codingapi.springboot.framework.event.IEvent;
4+
import com.codingapi.springboot.framework.event.IHandler;
5+
import lombok.extern.slf4j.Slf4j;
6+
import org.springframework.stereotype.Service;
7+
8+
@Slf4j
9+
@Service
10+
public class GlobalEventHandler implements IHandler<IEvent> {
11+
12+
@Override
13+
public void handler(IEvent event) {
14+
log.info("global event:{}", event);
15+
}
16+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.codingapi.example.handler;
2+
3+
import com.codingapi.example.event.AEvent;
4+
import com.codingapi.example.event.TestEvent;
5+
import com.codingapi.example.infra.entity.TestEntity;
6+
import com.codingapi.example.infra.jpa.TestEntityRepository;
7+
import com.codingapi.springboot.framework.event.EventPusher;
8+
import com.codingapi.springboot.framework.event.IHandler;
9+
import lombok.AllArgsConstructor;
10+
import org.springframework.stereotype.Repository;
11+
12+
@Repository
13+
@AllArgsConstructor
14+
public class Test2Handler implements IHandler<TestEvent> {
15+
16+
private TestEntityRepository testEntityRepository;
17+
18+
@Override
19+
public void handler(TestEvent event) {
20+
TestEntity entity = new TestEntity(event.getName()+"123");
21+
testEntityRepository.save(entity);
22+
23+
new Thread(()->{
24+
EventPusher.push(new AEvent());
25+
}).start();
26+
27+
// new Thread(()->{
28+
// EventPusher.push(new AEvent());
29+
// }).start();
30+
}
31+
32+
33+
@Override
34+
public int order() {
35+
return 100;
36+
}
37+
}

example/example-application/src/main/java/com/codingapi/example/handler/TestHandler.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ public void handler(TestEvent event) {
2424
EventPusher.push(new AEvent());
2525
}).start();
2626

27-
new Thread(()->{
28-
EventPusher.push(new AEvent());
29-
}).start();
27+
// new Thread(()->{
28+
// EventPusher.push(new AEvent());
29+
// }).start();
3030
}
3131

32-
32+
@Override
33+
public int order() {
34+
return 10;
35+
}
3336
}

example/example-domain/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.5</version>
8+
<version>3.3.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-flow/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.5</version>
8+
<version>3.3.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-infra-jpa/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.5</version>
8+
<version>3.3.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/example-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>springboot-example</artifactId>
77
<groupId>com.codingapi.springboot</groupId>
8-
<version>3.3.5</version>
8+
<version>3.3.6</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</parent>
1818

1919
<artifactId>springboot-example</artifactId>
20-
<version>3.3.5</version>
20+
<version>3.3.6</version>
2121

2222
<name>springboot-example</name>
2323
<description>springboot-example project for Spring Boot</description>

0 commit comments

Comments
 (0)