This commit is contained in:
2026-08-20 09:10:32 +08:00
6 changed files with 9 additions and 6 deletions
@@ -10,7 +10,7 @@ baiyue:
data-residency: ${DATA_RESIDENCY:OVERSEAS}
event-dispatcher:
consumer-url: ${LASTLEG_CONSUMER_URL:http://lastleg-service:9303/internal/lastleg/events}
fixed-delay: ${EVENT_DISPATCH_FIXED_DELAY:3s}
fixed-delay: ${EVENT_DISPATCH_FIXED_DELAY:3000}
batch-size: ${EVENT_DISPATCH_BATCH_SIZE:50}
max-attempts: ${EVENT_DISPATCH_MAX_ATTEMPTS:10}
lease-duration: ${EVENT_DISPATCH_LEASE_DURATION:30s}
@@ -23,7 +23,7 @@ public class OverseasEventDispatcher {
@Resource private EventDispatcherProperties properties;
private final String leaseOwner = ManagementFactory.getRuntimeMXBean().getName() + ":" + UUID.randomUUID();
@Scheduled(fixedDelayString = "${baiyue.event-dispatcher.fixed-delay:3s}")
@Scheduled(fixedDelayString = "${baiyue.event-dispatcher.fixed-delay:3000}")
public void dispatch() {
for (String eventId : inboxMapper.dispatchCandidates(properties.batchSize())) {
dispatchOne(eventId);
@@ -32,7 +32,7 @@ baiyue:
region: ${REGION_CODE:OVERSEAS}
event-dispatcher:
consumer-url: ${LASTLEG_CONSUMER_URL:http://127.0.0.1:9303/internal/lastleg/events}
fixed-delay: ${EVENT_DISPATCH_FIXED_DELAY:3s}
fixed-delay: ${EVENT_DISPATCH_FIXED_DELAY:3000}
batch-size: ${EVENT_DISPATCH_BATCH_SIZE:50}
max-attempts: ${EVENT_DISPATCH_MAX_ATTEMPTS:10}
lease-duration: ${EVENT_DISPATCH_LEASE_DURATION:30s}
@@ -20,7 +20,7 @@ public class WarehouseDatabaseGuardConfiguration {
Matcher matcher = MYSQL_SCHEMA.matcher(url);
if (!matcher.matches() || !"baiyue_lastlag_warehouse".equalsIgnoreCase(matcher.group(1))) {
throw new IllegalStateException(
"warehouse-overseas-service requires spring.datasource.url to target the baiyue_warehouse_overseas database");
"warehouse-overseas-service requires spring.datasource.url to target the baiyue_lastlag_warehouse database");
}
return beanFactory -> { };
}
@@ -22,11 +22,14 @@ spring:
username: ${NACOS_USERNAME:nacos}
password: ${NACOS_PASSWORD:nacos}
discovery:
server-addr: ${NACOS_SERVER_ADDR:127.0.0.1:8858}
enabled: ${NACOS_DISCOVERY_ENABLED:true}
register-enabled: ${NACOS_REGISTER_ENABLED:true}
group: ${NACOS_GROUP:BAIYUE}
namespace: ${NACOS_NAMESPACE:public}
config.namespace: ${NACOS_NAMESPACE:public}
config:
server-addr: ${NACOS_SERVER_ADDR:127.0.0.1:8858}
namespace: ${NACOS_NAMESPACE:public}
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${WAREHOUSE_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_lastlag_warehouse?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true}
@@ -19,7 +19,7 @@ class WarehouseDatabaseGuardConfigurationTest {
assertThat(properties.getProperty("spring.datasource.url"))
.asString()
.contains("baiyue_lastlag_warehouse")
.doesNotContain("baiyue_lastlag_warehouse");
.doesNotContain("baiyue_warehouse_overseas");
}
@Test