org.axonframework.eventhandling.EventHandler类的使用及代码示例

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

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

EventHandler介绍

暂无

代码示例

代码示例来源: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: EdisonXu/sbs-axon

@EventHandler
public void on(MoneyWithdrawnEvent event){
  BigDecimal result = this.balance.subtract(new BigDecimal(event.getAmount()));
  if(result.compareTo(BigDecimal.ZERO)<0)
    LOGGER.error("Cannot withdraw more money than the balance!");
  else {
    this.balance = result;
    LOGGER.info("Withdraw {} from account {}, balance result: {}", event.getAmount(), accountId, balance);
  }
}

代码示例来源:origin: vvgomes/event-driven-restaurant

@EventHandler
  public void on(MenuItemRemovedEvent event) {
    Optional
      .ofNullable(items.findOne(event.getId()))
      .ifPresent(items::delete);
  }
}

代码示例来源:origin: EdisonXu/sbs-axon

@EventHandler
public void on(AccountCreatedEvent event){
  this.accountId = event.getAccountId();
  this.accountName = event.getAccountName();
  this.balance = new BigDecimal(event.getAmount());
  LOGGER.info("Account {} is created with balance {}", accountId, this.balance);
}

代码示例来源:origin: EdisonXu/sbs-axon

@EventHandler
public void on(AccountCreatedEvent event){
  this.accountId = event.getAccountId();
  this.accountName = event.getAccountName();
  this.balance = new BigDecimal(event.getAmount());
  LOGGER.info("Account {} is created with balance {}", accountId, this.balance);
}

代码示例来源:origin: vvgomes/event-driven-restaurant

@EventHandler
  public void on(MenuItemRemovedEvent event) {
    Logger
      .getInstance(getClass())
      .info(format("Handling event: %s", event));

    menu.delete(event.getId());
  }
}

代码示例来源:origin: vvgomes/event-driven-restaurant

@EventHandler
  public void on(AddressAddedEvent event) {
    Optional
      .ofNullable(customers.findOne(event.getCustomerId()))
      .map(customer -> new Address(
        event.getAddressId(),
        event.getNickName(),
        event.getLocation(),
        customer))
      .ifPresent(addresses::save);
  }
}

代码示例来源:origin: vvgomes/event-driven-restaurant

@EventHandler
  public void on(CustomerSignedUpEvent event) {
    Logger
      .getInstance(getClass())
      .info(format("Handling event: %s", event));

    customers.save(new Customer(event.getId()));
  }
}

代码示例来源:origin: vvgomes/event-driven-restaurant

@EventHandler
  public void on(MenuItemModifiedEvent event) {
    Optional
      .ofNullable(items.findOne(event.getId()))
      .map(item -> item.withDescription(event.getDescription()).withPrice(event.getPrice()))
      .ifPresent(items::save);
  }
}

代码示例来源: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: vvgomes/event-driven-restaurant

@EventHandler
  public void on(CustomerSignedUpEvent event) {
    customers.save(new Customer(event.getId(), event.getEmail()));
  }
}

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

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

相关文章

EventHandler类方法