本文整理汇总了Java中org.axonframework.saga.annotation.SagaEventHandler类的典型用法代码示例。如果您正苦于以下问题:Java SagaEventHandler类的具体用法?Java SagaEventHandler怎么用?Java SagaEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SagaEventHandler类属于org.axonframework.saga.annotation包,在下文中一共展示了SagaEventHandler类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import org.axonframework.saga.annotation.SagaEventHandler; //导入依赖的package包/类
@StartSaga
@SagaEventHandler(associationProperty = "userId")
public void handle(UserRegistered event) {
System.out.println("A new user " + event.getPrefferedUsername() + " registered with the unconfirmed email " + event.getEmailAddress() + ".");
// compose and send out welcome and confirm email
System.out.println("Sending out a confirmation email with email verification code: " + event.getEmailVerificationCode());
ApplicationServiceRegistry.mailService().sendSignUpActivationMessage(
event.getEmailAddress(),
event.getPrefferedUsername(),
event.getEmailVerificationCode()
);
// HACK: FIXME: TODO:
// auto-confirm users that fulfil some criteria
autoConfirmTestUsersEmailAddress_HACK(event.getUserId(), event.getEmailAddress(), event.getEmailVerificationCode());
}
示例2: handle
import org.axonframework.saga.annotation.SagaEventHandler; //导入依赖的package包/类
@StartSaga
@SagaEventHandler(associationProperty = "itemId")
public void handle(ProductPurchasedEvent event) {
// identifiers
String deliveryId = createDeliveryId();
String invoiceId = createInvoiceId();
// associate the Saga with these values, before sending the commands
associateWith("shipmentId", deliveryId);
associateWith("invoiceId", invoiceId);
// send the commands
commandGateway.send(new PrepareDeliveryCommand(deliveryId));
commandGateway.send(new CreateInvoiceCommand(invoiceId));
}
示例3: handle
import org.axonframework.saga.annotation.SagaEventHandler; //导入依赖的package包/类
@StartSaga
@SagaEventHandler(associationProperty = "bookId")
public void handle(BorrowEvent event) {
popularityCount++;
if (popularityCount == 5) {
cmdGateway.send(new MarkBookHotCommand(event.getLibraryId(), event.getBookId()));
end();
}
}
示例4: handle
import org.axonframework.saga.annotation.SagaEventHandler; //导入依赖的package包/类
@StartSaga
@SagaEventHandler(associationProperty = "organizationId")
public void handle(OrganizationCreated event) {
alias = event.getPrimaryAlias();
System.out.println("AttachOrganizationAliasSaga: Emitted AddOrganizationAlias with alias " + alias + " for the organization " + event.getOrganizationId().identifier());
commandGateway.send(new AddOrganizationAlias(event.getOrganizationId(), event.getPrimaryAlias()));
}
示例5: handle
import org.axonframework.saga.annotation.SagaEventHandler; //导入依赖的package包/类
@StartSaga
@SagaEventHandler(associationProperty = "userId")
public void handle(ResetPasswordKeyGenerated event) {
System.out.println("User " + event.getUsername() + " has requested to reset password using " + event.getEmailAddress() + ".");
// compose and send out welcome and confirm email
System.out.println("Sending out reset password instruction email with the reset password key: " + event.getResetPasswordKey());
mailService().sendResetPasswordMessage(event.getEmailAddress(), event.getUsername(), event.getResetPasswordKey());
// HACK: FIXME: TODO:
// auto-confirm users that fulfil some criteria
autoResetTestUsersPassword_HACK(event.getUserId(), event.getEmailAddress(), event.getResetPasswordKey());
}
示例6: handle
import org.axonframework.saga.annotation.SagaEventHandler; //导入依赖的package包/类
@StartSaga
@SagaEventHandler(associationProperty = "organizationId")
public void handle(OrganizationCreated event, @MetaData(UserMetaData.USERNAME) String username) {
commandGateway.send(new AuthorizeMembershipToOrganizationCreator(event.getOrganizationId(), new MembershipId(event.getOrganizationId().identifier()), username));
end();
}
开发者ID:dma-graveyard,项目名称:MaritimeCloudPortalTestbed,代码行数:7,代码来源:SetupOrganizationOwnerMemberSaga.java