本文整理汇总了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");
}
});
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例11: RoleCommandHandler
import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public RoleCommandHandler(Repository<Role> repository, EventBus eventBus) {
this.repository = repository;
this.eventBus = eventBus;
}
示例12: TokenCommandHandler
import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public TokenCommandHandler(Repository<Token> repository, EventBus eventBus) {
this.repository = repository;
this.eventBus = eventBus;
}
示例13: UserCommandHandler
import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public UserCommandHandler(Repository<User> repository, EventBus eventBus) {
this.repository = repository;
this.eventBus = eventBus;
}
示例14: MenuCommandHandler
import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public MenuCommandHandler(Repository<Menu> repository, EventBus eventBus) {
this.repository = repository;
this.eventBus = eventBus;
}
示例15: OrgCommandHandler
import org.axonframework.eventhandling.EventBus; //导入依赖的package包/类
public OrgCommandHandler(Repository<Org> repository, EventBus eventBus) {
this.repository = repository;
this.eventBus = eventBus;
}