Skip to content
Merged

Dev #77

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/example-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.codingapi.example.command;

import com.codingapi.example.event.TestEvent;
import com.codingapi.example.infra.entity.TestEntity;
import com.codingapi.example.infra.jpa.TestEntityRepository;
import com.codingapi.springboot.framework.event.EventPusher;
import lombok.AllArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/open/test")
@AllArgsConstructor
public class TestController {

private final TestEntityRepository testEntityRepository;


@GetMapping("/hi")
@Transactional
public void hi(){
TestEntity testEntity = new TestEntity("test");
testEntityRepository.save(testEntity);

TestEvent event = new TestEvent(testEntity.getName());
EventPusher.push(event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.codingapi.example.event;

import com.codingapi.springboot.framework.event.IEvent;

public class AEvent implements IEvent {


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.codingapi.example.event;

import com.codingapi.springboot.framework.event.IEvent;

public class BEvent implements IEvent {


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.codingapi.example.event;

import com.codingapi.springboot.framework.event.IEvent;

public class CEvent implements IEvent {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.codingapi.example.event;

import com.codingapi.springboot.framework.event.IAsyncEvent;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class TestEvent implements IAsyncEvent {

private String name;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.codingapi.example.handler;

import com.codingapi.example.event.AEvent;
import com.codingapi.example.event.BEvent;
import com.codingapi.springboot.framework.event.EventPusher;
import com.codingapi.springboot.framework.event.EventTraceContext;
import com.codingapi.springboot.framework.event.IHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class AHandler implements IHandler<AEvent> {

@Override
public void handler(AEvent event) {
log.info("a event:{},eventKey:{}",event, EventTraceContext.getInstance().getEventKey());

EventPusher.push(new BEvent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.codingapi.example.handler;

import com.codingapi.example.event.BEvent;
import com.codingapi.example.event.CEvent;
import com.codingapi.springboot.framework.event.EventPusher;
import com.codingapi.springboot.framework.event.EventTraceContext;
import com.codingapi.springboot.framework.event.IHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class BHandler implements IHandler<BEvent> {

@Override
public void handler(BEvent event) {
log.info("b event:{},eventKey:{}",event, EventTraceContext.getInstance().getEventKey());

EventPusher.push(new CEvent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.codingapi.example.handler;

import com.codingapi.example.event.CEvent;
import com.codingapi.springboot.framework.event.EventTraceContext;
import com.codingapi.springboot.framework.event.IHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CHandler implements IHandler<CEvent> {

@Override
public void handler(CEvent event) {
log.info("c event:{},eventKey:{}", event, EventTraceContext.getInstance().getEventKey());

// EventPusher.push(new AEvent());
throw new RuntimeException("c handler error");
}

@Override
public void error(Exception exception) throws Exception {
log.error("c handler error:{}", exception.getMessage());
throw exception;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.codingapi.example.handler;

import com.codingapi.example.event.AEvent;
import com.codingapi.example.event.TestEvent;
import com.codingapi.example.infra.entity.TestEntity;
import com.codingapi.example.infra.jpa.TestEntityRepository;
import com.codingapi.springboot.framework.event.EventPusher;
import com.codingapi.springboot.framework.event.IHandler;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

@Repository
@AllArgsConstructor
public class TestHandler implements IHandler<TestEvent> {

private TestEntityRepository testEntityRepository;

@Override
public void handler(TestEvent event) {
TestEntity entity = new TestEntity(event.getName()+"123");
testEntityRepository.save(entity);

new Thread(()->{
EventPusher.push(new AEvent());
}).start();

new Thread(()->{
EventPusher.push(new AEvent());
}).start();
}


}
2 changes: 1 addition & 1 deletion example/example-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.codingapi.example.infra.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@Entity
@NoArgsConstructor
public class TestEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;

private String name;

public TestEntity(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.codingapi.example.infra.jpa;

import com.codingapi.example.infra.entity.TestEntity;
import com.codingapi.springboot.fast.jpa.repository.FastRepository;

public interface TestEntityRepository extends FastRepository<TestEntity,Long> {

}
2 changes: 1 addition & 1 deletion example/example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>

<artifactId>springboot-example</artifactId>
<version>3.3.3</version>
<version>3.3.5</version>

<name>springboot-example</name>
<description>springboot-example project for Spring Boot</description>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.3.3</version>
<version>3.3.5</version>

<url>https://github.com/codingapi/springboot-framewrok</url>
<name>springboot-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-data-fast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>

<name>springboot-starter-flow</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.codingapi.springboot.flow.matcher.OperatorMatcher;
import com.codingapi.springboot.flow.trigger.OutTrigger;
import com.codingapi.springboot.flow.user.IFlowOperator;
import com.codingapi.springboot.flow.utils.RandomGenerator;
import com.codingapi.springboot.framework.utils.RandomGenerator;

/**
* 流程工作构建器
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.codingapi.springboot.flow.build.SchemaReader;
import com.codingapi.springboot.flow.serializable.FlowWorkSerializable;
import com.codingapi.springboot.flow.user.IFlowOperator;
import com.codingapi.springboot.flow.utils.RandomGenerator;
import com.codingapi.springboot.framework.utils.RandomGenerator;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.codingapi.springboot.flow.record;

import com.codingapi.springboot.flow.user.IFlowOperator;
import com.codingapi.springboot.flow.utils.RandomGenerator;
import com.codingapi.springboot.framework.utils.RandomGenerator;
import lombok.AllArgsConstructor;
import lombok.Getter;

Expand Down
2 changes: 1 addition & 1 deletion springboot-starter-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>springboot-parent</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>

<artifactId>springboot-starter-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion springboot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-parent</artifactId>
<version>3.3.3</version>
<version>3.3.5</version>
</parent>
<artifactId>springboot-starter</artifactId>

Expand Down
Loading