بنقرة واحدة
automation-slice
Generate event-driven automation processors for AUTOMATION slices
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Generate event-driven automation processors for AUTOMATION slices
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Generate projection integration tests from STATE_VIEW specifications
Transform slice definitions from config.json into executable Java code
Generate commands, events, aggregates, REST controllers (POST), and tests for STATE_CHANGE slices
Generate read models, projectors, queries, and REST controllers (GET) for STATE_VIEW slices
| name | automation-slice |
| description | Generate event-driven automation processors for AUTOMATION slices |
An AUTOMATION slice contains processors that react to events and trigger commands automatically. Automation processors appear in the processors array of a STATE_CHANGE slice.
Source Event → @EventHandler Processor → CommandGateway.send() → Target Command
@EventHandlerCommandGateway to send commands@DisallowReplay to prevent re-triggering on replayLook at processor dependencies:
Location: src/main/java/de/eventmodelers/<context>/slices/<slicename>/internal/<ProcessorName>Processor.java
package de.eventmodelers.<context>.slices.<slicename>.internal;
import de.eventmodelers.common.Processor;
import de.eventmodelers.events.<SourceEvent>Event;
import de.eventmodelers.<context>.ProcessingGroups;
import de.eventmodelers.domain.commands.<TargetCommand>Command;
import org.axonframework.commandhandling.gateway.CommandGateway;
import org.axonframework.config.ProcessingGroup;
import org.axonframework.eventhandling.DisallowReplay;
import org.axonframework.eventhandling.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ProcessingGroup(ProcessingGroups.<CONTEXT>)
@Component
public class <ProcessorName>Processor implements Processor {
private static final Logger logger = LoggerFactory.getLogger(<ProcessorName>Processor.class);
private final CommandGateway commandGateway;
public <ProcessorName>Processor(CommandGateway commandGateway) {
this.commandGateway = commandGateway;
}
@DisallowReplay
@EventHandler
public void on(<SourceEvent>Event event) {
commandGateway.send(
new <TargetCommand>Command(
event.aggregateId()
// Map event fields to command fields
)
);
}
}
When processor fields have a mapping attribute:
{ "name": "userId", "type": "String", "mapping": "owner" }
This means map from the source event's owner field to the command's expected field.
Location: src/test/java/de/eventmodelers/<context>/slices/<slicename>/<ProcessorName>ProcessorTest.java
package de.eventmodelers.<context>.slices.<slicename>;
import de.eventmodelers.<context>.slices.<slicename>.internal.<ProcessorName>Processor;
import de.eventmodelers.events.<SourceEvent>Event;
import de.eventmodelers.domain.commands.<TargetCommand>Command;
import org.axonframework.commandhandling.gateway.CommandGateway;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.util.UUID;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.verify;
class <ProcessorName>ProcessorTest {
@Test
void shouldSendCommandWhenEventReceived() {
var commandGateway = Mockito.mock(CommandGateway.class);
var processor = new <ProcessorName>Processor(commandGateway);
var event = new <SourceEvent>Event(UUID.randomUUID());
processor.on(event);
verify(commandGateway).send(argThat((<TargetCommand>Command cmd) ->
cmd.aggregateId().equals(event.aggregateId())
));
}
}
@DisallowReplay - Prevents re-sending commands during event store replays