### Install easyevent-spring-boot-starter-soa Module (Maven)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Navigate to the easyevent-spring-boot-starter-soa directory (relative to the basic starter) and execute the Maven command to clean and install this module locally. This starter is for SOA-specific integration.
```shell
cd ./../easyevent-spring-boot-starter-soa
mvn clean install
```
--------------------------------
### Install easyevent-common Module (Maven)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Navigate to the easyevent-common directory and execute the Maven command to clean and install the module into the local repository. This is the first step in building the project locally.
```shell
cd easyevent-common
mvn clean install
```
--------------------------------
### Install easyevent-storage Module (Maven)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Navigate to the easyevent-storage directory (relative to the common module) and execute the Maven command to clean and install this module locally. This module handles event persistence.
```shell
cd ./../easyevent-storage
mvn clean install
```
--------------------------------
### Install easyevent-spring-boot-starter Module (Maven)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Navigate to the easyevent-spring-boot-starter directory (relative to the core module) and execute the Maven command to clean and install this module locally. This is the basic Spring Boot starter for EasyEvent.
```shell
cd ./../easyevent-spring-boot-starter
mvn clean install
```
--------------------------------
### Install easyevent-core Module (Maven)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Navigate to the easyevent-core directory (relative to the transfer module) and execute the Maven command to clean and install this module locally. This module contains the core logic of EasyEvent.
```shell
cd ./../easyevent-core
mvn clean install
```
--------------------------------
### Install easyevent-transfer Module (Maven)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Navigate to the easyevent-transfer directory (relative to the storage module) and execute the Maven command to clean and install this module locally. This module provides the event transfer mechanism interfaces.
```shell
cd ./../easyevent-transfer
mvn clean install
```
--------------------------------
### Add Disruptor Starter Dependency (Maven XML)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Include this Maven dependency in your project's pom.xml file to use Disruptor as the event transfer mechanism. Replace ${lastVersion} with the actual version.
```xml
com.openquartz
easyevent-spring-boot-starter-disruptor
${lastVersion}
```
--------------------------------
### Add Kafka Starter Dependency (Maven XML)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Include this Maven dependency in your project's pom.xml file to use Kafka as the event transfer mechanism. Replace ${lastVersion} with the actual version.
```xml
com.openquartz
easyevent-spring-boot-starter-kafka
${lastVersion}
```
--------------------------------
### Add RocketMQ Starter Dependency (Maven XML)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Include this Maven dependency in your project's pom.xml file to use RocketMQ as the event transfer mechanism. This is the recommended option. Replace ${lastVersion} with the actual version.
```xml
com.openquartz
easyevent-spring-boot-starter-rocketmq
${lastVersion}
```
--------------------------------
### Create Event Storage Table (SQL)
Source: https://github.com/openquartz/easy-event/blob/master/doc/QuickStart.md
Execute this SQL script to create the `ee_bus_event_entity` table required for event storage. This table stores event details, processing state, and metadata. Note the comment about sharding if enabled.
```sql
CREATE TABLE ee_bus_event_entity
(
id BIGINT (20) NOT NULL AUTO_INCREMENT COMMENT 'eventId',
app_id VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'appId',
source_id BIGINT (20) NOT NULL DEFAULT 0 COMMENT 'sourceId',
class_name VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Event-Class',
error_count TINYINT (3) NOT NULL DEFAULT 0 COMMENT '执行错误次数',
processing_state VARCHAR(50) NOT NULL DEFAULT '' COMMENT '执行状态',
successful_subscriber VARCHAR(512) NOT NULL DEFAULT '' COMMENT '执行成功的订阅者',
trace_id VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'traceId',
event_data TEXT NOT NULL COMMENT 'EventData',
event_key VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'EventKey',
creating_owner VARCHAR(50) NOT NULL DEFAULT '' COMMENT '创建者机器',
processing_owner VARCHAR(50) NOT NULL DEFAULT '' COMMENT '生产者机器',
processing_available_date TIMESTAMP DEFAULT NULL COMMENT '执行有效时间',
processing_failed_reason VARCHAR(128) NOT NULL DEFAULT '' COMMENT '已经执行失败的原因',
created_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (id),
INDEX idx_event_key (event_key),
INDEX idx_app_state_owner_time(app_id, processing_state, processing_owner, created_time)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'ee_bus_event_entity';
```
--------------------------------
### Defining JDBC Sharding Router Interface (Java)
Source: https://github.com/openquartz/easy-event/blob/master/doc/Extend.md
This interface provides an extension point for defining custom table sharding logic based on the `EventEntityID` when using JDBC storage. It includes methods to calculate the shard index for a given entity ID and to specify the total number of shards, allowing users to implement strategies like hash sharding.
```java
package com.openquartz.easyevent.storage.jdbc.sharding;
/**
* sharding
*
* @author svnee
*/
public interface ShardingRouter {
/**
* 分片
*
* 如果不开启分片时,需要返回值小于0即可。否则返回的是下标
*
* @param eventEntityId entityId
* @return sharding index
*/
int sharding(Long eventEntityId);
/**
* totalSharding
* @return totalSharding
*/
int totalSharding();
}
```
--------------------------------
### Defining Distributed Lock Factory Interface (Java)
Source: https://github.com/openquartz/easy-event/blob/master/doc/Extend.md
This interface provides an extension point for users to implement a distributed lock mechanism, which is crucial for ensuring concurrent safety in distributed environments, especially when compensation jobs might lead to concurrent event processing. Users should implement this interface using a third-party distributed lock middleware and register it in the Spring context.
```java
package com.openquartz.easyevent.common.concurrent.lock;
import java.util.concurrent.locks.Lock;
import com.openquartz.easyevent.common.model.Pair;
/**
* Distributed EventLock
*
* @author svnee
*/
public interface DistributedLockFactory {
/**
* Get Lock
*
* @param lockKey lockKey
* @return lock must not be null
*/
Lock getLock(Pair lockKey);
}
```
--------------------------------
### Defining Event Sender Limiting Control Interface (Java)
Source: https://github.com/openquartz/easy-event/blob/master/doc/Extend.md
This interface provides an extension point for implementing rate limiting logic before sending event messages. It includes methods for controlling both single events and batches of events, requiring implementations to throw `LimitingBlockedException` if a request is blocked.
```java
package com.openquartz.easyevent.transfer.api.limiting;
import java.util.List;
import java.util.function.BiConsumer;
import com.openquartz.easyevent.storage.identify.EventId;
/**
* EventTransfer Sender Limiting Control
*
* @author svnee
*/
public interface EventTransferSenderLimitingControl {
/**
* control event handle
* if limiting blocked throw {@link LimitingBlockedException}
*
* @param event event content
* @param eventId eventId
* @param senderConsumer sender function
*/
void control(T event, EventId eventId, BiConsumer senderConsumer);
/**
* control event handle
* if limiting blocked throw {@link LimitingBlockedException}
*
* @param eventList eventList
* @param eventIdList eventIdList
* @param batchSenderConsumer batch sender function
*/
void control(List eventList, List eventIdList,
BiConsumer, List> batchSenderConsumer);
}
```
--------------------------------
### Defining Event Trigger Limiting Control Interface (Java)
Source: https://github.com/openquartz/easy-event/blob/master/doc/Extend.md
This interface serves as an extension point for implementing rate limiting logic before triggering or consuming event messages. It provides a method to control the handling of individual `EventMessage` instances, requiring implementations to throw `LimitingBlockedException` if limiting blocks the operation.
```java
package com.openquartz.easyevent.transfer.api.limiting;
import java.util.function.Consumer;
import com.openquartz.easyevent.transfer.api.message.EventMessage;
/**
* EventTransfer Trigger Limiting Control
*
* @author svnee
*/
public interface EventTransferTriggerLimitingControl {
/**
* control
* if limiting blocked throw {@link LimitingBlockedException}
*
* @param eventMessage event-message
* @param eventHandleFunction function
*/
void control(EventMessage eventMessage, Consumer eventHandleFunction);
}
```
--------------------------------
### Defining Event ID Generator Interface (Java)
Source: https://github.com/openquartz/easy-event/blob/master/doc/Extend.md
This interface allows users to provide a custom strategy for generating `EventId` when using JDBC storage, offering an alternative to the default database auto-increment approach. Implementations should provide a `generateId` method that returns the custom ID or `null` to fall back to the default mechanism.
```java
package com.openquartz.easyevent.storage.identify;
/**
* ID 生成 器
*
* @author svnee
**/
public interface IdGenerator {
/**
* 生成ID
* 如果返回null 代表使用数据库自增实现
*
* @return ID
*/
default Long generateId() {
return null;
}
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.