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


Java EventBus类代码示例

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


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

示例1: createInjector

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
private Injector createInjector() {
    return Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            // Event store
            CommandBus commandBus = new SimpleCommandBus();
            CommandGateway commandGateway = new DefaultCommandGateway(commandBus);

            EventStore eventStore = new FileSystemEventStore(new SimpleEventFileResolver(eventStoreFolder));

            EventBus eventBus = new SimpleEventBus();

            EventSourcingRepository repository = new EventSourcingRepository(Rating.class, eventStore);
            repository.setEventBus(eventBus);

            // Event store handlers
            AggregateAnnotationCommandHandler.subscribe(Rating.class, repository, commandBus);
            AnnotationEventListenerAdapter.subscribe(new RatingEventHandler(), eventBus);

            // Load twist config
            TwistProvider twistProvider = new TwistProvider(twistsDataFile);

            // Twist rating
            TwistRating twistRating = new TwistRatingEventStore(commandGateway, twistProvider);


            // Bootstrap aggregates
            twistProvider.getTwists().stream().forEach(twist -> {
                commandGateway.send(new CreateTwistCommand(twist.id));
            });

            // Set up bindings
            bind(TwistRating.class).toInstance(twistRating);
            bind(TwistProvider.class).toInstance(twistProvider);

            Logger.info("Injector configured");
        }
    });
}
 
开发者ID:tipsy,项目名称:twistrating,代码行数:40,代码来源:Global.java

示例2: springMessagingEventBus

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public EventBus springMessagingEventBus(
        final SubscribableChannel channel) {
    final SpringMessagingEventBus eventBus
            = new SpringMessagingEventBus();
    eventBus.setChannel(channel);
    return eventBus;
}
 
开发者ID:binkley,项目名称:axon-spring-boot-starter,代码行数:10,代码来源:AxonSpringMessagingAutoConfiguration.java

示例3: eventSourcingRepositoryRegistrar

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@SuppressWarnings("SpringJavaAutowiringInspection")
@Bean
public EventSourcingRepositoryRegistrar eventSourcingRepositoryRegistrar(
        final CommandBus commandBus, final EventBus eventBus,
        final EventStore eventStore) {
    return new EventSourcingRepositoryRegistrar(commandBus, eventBus,
            eventStore);
}
 
开发者ID:binkley,项目名称:axon-spring-boot-starter,代码行数:9,代码来源:AxonAutoConfiguration.java

示例4: respository

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Bean(name = "testAggregateEventsourcingRepository")
@Autowired
public EventSourcingRepository<MyTestAggregate> respository(final EventStore eventStore, final EventBus eventBus, final Cache cache) {
   final CachingEventSourcingRepository<MyTestAggregate> repository = new CachingEventSourcingRepository<>(new GenericAggregateFactory<>(MyTestAggregate.class), eventStore);
   repository.setCache(cache);
   repository.setEventBus(eventBus);
   return repository;
}
 
开发者ID:Qyotta,项目名称:axon-eventstore,代码行数:9,代码来源:TestConfiguration.java

示例5: annotationEventListenerBeanPostProcessor

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Bean
@Autowired
public AnnotationEventListenerBeanPostProcessor annotationEventListenerBeanPostProcessor(final EventBus eventBus) {
   final AnnotationEventListenerBeanPostProcessor processor = new AnnotationEventListenerBeanPostProcessor();
   processor.setEventBus(eventBus);
   return processor;
}
 
开发者ID:Qyotta,项目名称:axon-eventstore,代码行数:8,代码来源:TestConfiguration.java

示例6: respository

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Bean(name = "testAggregateEventsourcingRepository")
@Autowired
public EventSourcingRepository<MyTestAggregate> respository(final EventStore eventStore, final EventBus eventBus) {
   final EventSourcingRepository<MyTestAggregate> repository = new EventSourcingRepository<>(MyTestAggregate.class, eventStore);
   repository.setEventBus(eventBus);
   return repository;
}
 
开发者ID:Qyotta,项目名称:axon-eventstore,代码行数:8,代码来源:TestConfiguration.java

示例7: autoEventSourcingRepositoryCreator

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Bean
public AutoEventSourcingRepositoryCreator autoEventSourcingRepositoryCreator(CommandBus commandBus, EventBus eventBus, EventStore eventStore){
    AutoEventSourcingRepositoryCreator bean = new AutoEventSourcingRepositoryCreator();
    bean.setCommandBus(commandBus);
    bean.setEventBus(eventBus);
    bean.setEventStore(eventStore);
    return bean;
}
 
开发者ID:tomsoete,项目名称:spring-boot-starter-axon,代码行数:9,代码来源:AxonAutoConfiguration.java

示例8: autoConfiguration

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Test
public void autoConfiguration() throws Exception {
    this.context.register(AxonAutoConfiguration.class);
    this.context.refresh();
    assertNotNull(this.context.getBean(CommandBus.class));
    assertNotNull(this.context.getBean(CommandGateway.class));
    assertNotNull(this.context.getBean(EventBus.class));
    assertNotNull(this.context.getBean(EventStore.class));
    assertNotNull(this.context.getBean(IdentifierFactory.class));
}
 
开发者ID:tomsoete,项目名称:spring-boot-starter-axon,代码行数:11,代码来源:AxonAutoConfigurationTest.java

示例9: create

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T create(final Bean<T> bean, final CreationalContext<T> creationalContext) {
	EventBus eventBus = (EventBus) eventSchedulerInfo.getEventStoreReference(beanManager);
	return (T) new SimpleEventScheduler(Executors.newSingleThreadScheduledExecutor(),
			eventBus);
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi,代码行数:8,代码来源:SimpleEventSchedulerContextualLifecycle.java

示例10: createEventBus

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
private EventBus createEventBus() {
    if(m_evtBus == null) {
        m_evtBus = (m_evtBusTer != null)
            ? new ClusteringEventBus(m_evtBusTer)
            : new SimpleEventBus();
    }

    return m_evtBus;
}
 
开发者ID:lburgazzoli,项目名称:lb-axon,代码行数:10,代码来源:AxonService.java

示例11: RoleCommandHandler

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public RoleCommandHandler(Repository<Role> repository, EventBus eventBus) {
    this.repository = repository;
    this.eventBus = eventBus;
}
 
开发者ID:weechang,项目名称:Taroco,代码行数:5,代码来源:RoleCommandHandler.java

示例12: TokenCommandHandler

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public TokenCommandHandler(Repository<Token> repository, EventBus eventBus) {
    this.repository = repository;
    this.eventBus = eventBus;
}
 
开发者ID:weechang,项目名称:Taroco,代码行数:5,代码来源:TokenCommandHandler.java

示例13: UserCommandHandler

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public UserCommandHandler(Repository<User> repository, EventBus eventBus) {
    this.repository = repository;
    this.eventBus = eventBus;
}
 
开发者ID:weechang,项目名称:Taroco,代码行数:5,代码来源:UserCommandHandler.java

示例14: MenuCommandHandler

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public MenuCommandHandler(Repository<Menu> repository, EventBus eventBus) {
    this.repository = repository;
    this.eventBus = eventBus;
}
 
开发者ID:weechang,项目名称:Taroco,代码行数:5,代码来源:MenuCommandHandler.java

示例15: OrgCommandHandler

import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public OrgCommandHandler(Repository<Org> repository, EventBus eventBus) {
    this.repository = repository;
    this.eventBus = eventBus;
}
 
开发者ID:weechang,项目名称:Taroco,代码行数:5,代码来源:OrgCommandHandler.java


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