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


Java DomainEvent类代码示例

本文整理汇总了Java中com.networknt.tram.event.common.DomainEvent的典型用法代码示例。如果您正苦于以下问题:Java DomainEvent类的具体用法?Java DomainEvent怎么用?Java DomainEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DomainEvent类属于com.networknt.tram.event.common包,在下文中一共展示了DomainEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: messageHandler

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public void messageHandler(Message message) {
  String aggregateType = message.getRequiredHeader(EventMessageHeaders.AGGREGATE_TYPE);

  Optional<DomainEventHandler> handler = domainEventHandlers.findTargetMethod(message);

  if (!handler.isPresent()) {
    return;
  }

  DomainEvent param = JSonMapper.fromJson(message.getPayload(), handler.get().getEventClass());

  handler.get().invoke(new DomainEventEnvelopeImpl<>(message,
          aggregateType,
          message.getRequiredHeader(EventMessageHeaders.AGGREGATE_ID),
          message.getRequiredHeader(Message.ID),
          param));

}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:19,代码来源:DomainEventDispatcher.java

示例2: publish

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
@Override
public void publish(String aggregateType, Object aggregateId, Map<String, String> headers, List<DomainEvent> domainEvents) {
  for (DomainEvent event : domainEvents) {
    messageProducer.send(aggregateType,
            makeMessageForDomainEvent(aggregateType, aggregateId, headers, event));

  }
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:9,代码来源:DomainEventPublisherImpl.java

示例3: makeMessageForDomainEvent

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public static Message makeMessageForDomainEvent(String aggregateType, Object aggregateId, Map<String, String> headers, DomainEvent event) {
  String aggregateIdAsString = aggregateId.toString();
  return MessageBuilder
          .withPayload(JSonMapper.toJson(event))
          .withExtraHeaders("", headers)
          .withHeader(Message.PARTITION_ID, aggregateIdAsString)
          .withHeader(EventMessageHeaders.AGGREGATE_ID, aggregateIdAsString)
          .withHeader(EventMessageHeaders.AGGREGATE_TYPE, aggregateType)
          .withHeader(EventMessageHeaders.EVENT_TYPE, event.getClass().getName())
          .build();
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:12,代码来源:DomainEventPublisherImpl.java

示例4: ResultWithEvents

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public ResultWithEvents(T result, List<DomainEvent> events) {
  this.result = result;
  this.events = events;
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:5,代码来源:ResultWithEvents.java

示例5: publish

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
default void publish(Class<?> aggregateType, Object aggregateId, List<DomainEvent> domainEvents) {
  publish(aggregateType.getName(), aggregateId, domainEvents);
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:4,代码来源:DomainEventPublisher.java

示例6: DomainEventHandler

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public DomainEventHandler(String aggregateType, Class<DomainEvent> eventClass, Consumer<DomainEventEnvelope<DomainEvent>> handler) {
  this.aggregateType = aggregateType;
  this.eventClass = eventClass;
  this.handler = handler;
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:6,代码来源:DomainEventHandler.java

示例7: invoke

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public void invoke(DomainEventEnvelope<DomainEvent> dee) {
  handler.accept(dee);
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:4,代码来源:DomainEventHandler.java

示例8: getEventClass

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public Class<DomainEvent> getEventClass() {
  return eventClass;
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:4,代码来源:DomainEventHandler.java

示例9: onEvent

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <E extends DomainEvent> DomainEventHandlersBuilder onEvent(Class<E> eventClass, Consumer<DomainEventEnvelope<E>> handler) {
  handlers.add(new DomainEventHandler(aggregateType, ((Class<DomainEvent>) eventClass), (e) -> handler.accept((DomainEventEnvelope<E>) e)));
  return this;
}
 
开发者ID:networknt,项目名称:light-tram-4j,代码行数:6,代码来源:DomainEventHandlersBuilder.java

示例10: EventClassAndAggregateId

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public EventClassAndAggregateId(Class<DomainEvent> eventClass, Long aggregateId) {
  this.eventClass = eventClass;
  this.aggregateId = aggregateId;
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:5,代码来源:EventClassAndAggregateId.java

示例11: EventToPublish

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public EventToPublish(Class aggregateType, String aggregateId, List<DomainEvent> domainEvents) {
  this.aggregateType = aggregateType;
  this.aggregateId = aggregateId;
  this.domainEvents = domainEvents;
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:6,代码来源:EventToPublish.java

示例12: getDomainEvents

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public List<DomainEvent> getDomainEvents() {
  return domainEvents;
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:4,代码来源:EventToPublish.java

示例13: SagaEventHandler

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public SagaEventHandler(Class<DomainEvent> eventClass, Function<Data, Long> aggregateIdProvider, SagaStateMachineAction<Data, DomainEventEnvelope<DomainEvent>> action) {
  this.eventClass = eventClass;
  this.aggregateIdProvider = aggregateIdProvider;
  this.action = action;
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:6,代码来源:SagaEventHandler.java

示例14: make

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public static <Data> SagaEventHandler make(Class<DomainEvent> eventClass, Function<Data, Long> aggregateIdProvider,
                                                                                              SagaStateMachineAction<Data, DomainEventEnvelope<DomainEvent>> eventHandler) {
  return new SagaEventHandler<Data>(eventClass, aggregateIdProvider, eventHandler);
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:5,代码来源:SagaEventHandler.java

示例15: getAction

import com.networknt.tram.event.common.DomainEvent; //导入依赖的package包/类
public SagaStateMachineAction<Data, DomainEventEnvelope<DomainEvent>> getAction() {
  return action;
}
 
开发者ID:networknt,项目名称:light-saga-4j,代码行数:4,代码来源:SagaEventHandler.java


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