org.axonframework.eventhandling.EventHandler.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中org.axonframework.eventhandling.EventHandler.<init>()方法的一些代码示例,展示了EventHandler.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EventHandler.<init>()方法的具体详情如下:
包路径:org.axonframework.eventhandling.EventHandler
类名称:EventHandler
方法名:<init>

EventHandler.<init>介绍

暂无

代码示例

代码示例来源:origin: AxonFramework/AxonFramework

@EventHandler
public void onMessage(CreatedEvent event) {
  this.id = event.id;
}

代码示例来源:origin: AxonFramework/AxonFramework

@EventHandler
public void handleEvent(EventMessage event) {
  capturedEvents.add(event);
}

代码示例来源:origin: AxonFramework/AxonFramework

@EventHandler
public void on(UserCreatedEvent event) {
  System.out.println("User created event handled");
}

代码示例来源:origin: AxonFramework/AxonFramework

@EventHandler
protected void handle(EventMessage event) {
  identifier = ((DomainEventMessage) event).getAggregateIdentifier();
}

代码示例来源:origin: AxonFramework/AxonFramework

@EventHandler
public void handleLoopingEvent(LoopingChangeDoneEvent event) {
  commandBus.dispatch(asCommandMessage(new UpdateStubAggregateCommand(event.getAggregateIdentifier())));
}

代码示例来源:origin: org.apache.isis.core/isis-core-plugins-eventbus-axon

@org.axonframework.eventhandling.EventHandler
  public void on1(Type1 obj) {
    this.obj = obj;
  }
}

代码示例来源:origin: org.apache.isis.core/isis-core-plugins-eventbus-axon

@org.axonframework.eventhandling.EventHandler
  public void on2(Type1 obj) {
    this.obj = obj;
  }
}

代码示例来源:origin: avthart/spring-boot-axon-sample

@EventHandler
void on(TaskCompletedEvent event) {
  TaskEntry task = taskEntryRepository.findOne(event.getId());
  publish(task.getUsername(), event);
}

代码示例来源:origin: avthart/spring-boot-axon-sample

@EventHandler
void on(TaskCompletedEvent event) {
  TaskEntry task = taskEntryRepository.findOne(event.getId());
  task.setCompleted(true);
  
  taskEntryRepository.save(task);
}

代码示例来源:origin: AxonFramework/AxonBank

@EventHandler
public void on(BankTransferCompletedEvent event) {
  BankTransferEntry bankTransferEntry = repository.findOneByAxonBankTransferId(event.getBankTransferId());
  bankTransferEntry.setStatus(BankTransferEntry.Status.COMPLETED);
  repository.save(bankTransferEntry);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(ItemsReservedEvent event) {
  OrderBookId orderBookId = event.getOrderBookId();
  logger.debug("Handle ItemsReservedEvent for orderBook with identifier {}", orderBookId);
  ItemEntry itemEntry = createItemEntry(orderBookId.getIdentifier(), event.getAmountOfItemsReserved());
  PortfolioView portfolioView = portfolioViewRepository.findOne(event.getPortfolioId().getIdentifier());
  portfolioView.addReservedItem(itemEntry);
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(ItemsAddedToPortfolioEvent event) {
  OrderBookId orderBookId = event.getOrderBookId();
  logger.debug("Handle ItemsAddedToPortfolioEvent for orderBook with identifier {}", orderBookId);
  ItemEntry itemEntry = createItemEntry(orderBookId.getIdentifier(), event.getAmountOfItemsAdded());
  PortfolioView portfolioView = portfolioViewRepository.findOne(event.getPortfolioId().getIdentifier());
  portfolioView.addItemInPossession(itemEntry);
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(CashDepositedEvent event) {
  PortfolioView portfolioView = portfolioViewRepository.findOne(event.getPortfolioId().getIdentifier());
  portfolioView.setAmountOfMoney(portfolioView.getAmountOfMoney() + event.getMoneyAddedInCents());
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(CashReservationCancelledEvent event) {
  PortfolioView portfolioView = portfolioViewRepository.findOne(event.getPortfolioId().getIdentifier());
  portfolioView.setReservedAmountOfMoney(
      portfolioView.getReservedAmountOfMoney() - event.getAmountOfMoneyToCancel()
  );
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(CashReservedEvent event) {
  PortfolioView portfolioView = portfolioViewRepository.findOne(event.getPortfolioId().getIdentifier());
  portfolioView.setReservedAmountOfMoney(portfolioView.getReservedAmountOfMoney() + event.getAmountToReserve());
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/AxonBank

@EventHandler
public void on(MoneyAddedEvent event) {
  BankAccountEntry bankAccountEntry = repository.findOneByAxonBankAccountId(event.getBankAccountId());
  bankAccountEntry.setBalance(bankAccountEntry.getBalance() + event.getAmount());
  repository.save(bankAccountEntry);
  broadcastUpdates();
}

代码示例来源:origin: AxonFramework/AxonBank

@EventHandler
public void on(MoneySubtractedEvent event) {
  BankAccountEntry bankAccountEntry = repository.findOneByAxonBankAccountId(event.getBankAccountId());
  bankAccountEntry.setBalance(bankAccountEntry.getBalance() - event.getAmount());
  repository.save(bankAccountEntry);
  broadcastUpdates();
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(ItemReservationCancelledForPortfolioEvent event) {
  OrderBookId orderBookId = event.getOrderBookId();
  logger.debug("Handle ItemReservationCancelledForPortfolioEvent for orderBook with identifier {}", orderBookId);
  ItemEntry itemEntry = createItemEntry(orderBookId.getIdentifier(), event.getAmountOfCancelledItems());
  PortfolioView portfolioView = portfolioViewRepository.findOne(event.getPortfolioId().getIdentifier());
  portfolioView.removeReservedItem(orderBookId.getIdentifier(), event.getAmountOfCancelledItems());
  portfolioView.addItemInPossession(itemEntry);
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
public void on(PortfolioCreatedEvent event) {
  String userIdString = event.getUserId().getIdentifier();
  logger.debug("About to handle the PortfolioCreatedEvent for user with identifier {}", userIdString);
  PortfolioView portfolioView = new PortfolioView();
  portfolioView.setIdentifier(event.getPortfolioId().getIdentifier());
  portfolioView.setUserIdentifier(userIdString);
  portfolioView.setUserName(userViewRepository.findByIdentifier(userIdString).getFullName());
  portfolioView.setAmountOfMoney(0);
  portfolioView.setReservedAmountOfMoney(0);
  portfolioViewRepository.save(portfolioView);
}

代码示例来源:origin: AxonFramework/Axon-trader

@EventHandler
  public void on(UserCreatedEvent event) {
    UserView userView = new UserView();

    userView.setIdentifier(event.getUserId().getIdentifier());
    userView.setName(event.getName());
    userView.setUsername(event.getUsername());
    userView.setPassword(event.getPassword());

    userRepository.save(userView);
  }
}

相关文章

EventHandler类方法