当前位置: 首页>>代码示例>>Java>>正文


Java SagaEventHandler类代码示例

本文整理汇总了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());
}
 
开发者ID:dma-graveyard,项目名称:MaritimeCloudPortalTestbed,代码行数:19,代码来源:ConfirmEmailAddressSaga.java

示例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));
}
 
开发者ID:feliciatucci,项目名称:cqrs-sample,代码行数:14,代码来源:PurchaseManagementSaga.java

示例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();
	}
}
 
开发者ID:yizhuan,项目名称:library-saga,代码行数:10,代码来源:BookAdminSaga.java

示例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()));
}
 
开发者ID:dma-graveyard,项目名称:MaritimeCloudPortalTestbed,代码行数:8,代码来源:AttachOrganizationAliasSaga.java

示例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());
}
 
开发者ID:dma-graveyard,项目名称:MaritimeCloudPortalTestbed,代码行数:16,代码来源:ResetPasswordSaga.java

示例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


注:本文中的org.axonframework.saga.annotation.SagaEventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。