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


Java SimpleCommandBus类代码示例

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


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

示例1: createInjector

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的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: createCommandBus

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
private CommandBus createCommandBus() {
    if(m_cmdBus == null && m_evtStore != null && m_evtBus != null) {
        // The EventSourcingRepository factory
        m_repositoryFactory = new CachingEventSourcingRepositoryFactory(
            m_cache,
            m_evtStore,
            m_evtBus);

        // The CommandBus connector
        // TODO: check
        m_connector = new HzCommandBusConnector(
            m_hzInstance,
            new SimpleCommandBus(),
            m_hzInstance.getName(),
            m_nodeName);

        m_connector.open();

        m_cmdBus = new DistributedCommandBus(m_connector);
    }

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

示例3: configure

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Override
public Configurer configure(Configurer configurer) {
    SimpleCommandBus localCommandBus = new SimpleCommandBus();
    configurer = configurer
            .registerComponent(AxonMessageSerializer.class, c -> new DefaultAxonMessageSerializer(
                    c.serializer(), c.getComponent(EventUpcasterChain.class, EventUpcasterChain::new)))
            .registerComponent(ResultProcessor.class,
                               c -> new ResultProcessor(c.getComponent(AxonMessageSerializer.class),
                                                        createConsumerService(MessageType.RESULT),
                                                        format("%s/result", applicationProperties.getApplicationName())))
            .registerComponent(CommandProcessor.class,
                               c -> new CommandProcessor(
                                       c.getComponent(AxonMessageSerializer.class),
                                       localCommandBus, createProducerService(MessageType.RESULT),
                                       format("%s/command", applicationProperties.getApplicationName()),
                                       createConsumerService(MessageType.COMMAND)))
            .registerComponent(RoutingStrategy.class,
                               c -> new AnnotationRoutingStrategy(UnresolvedRoutingKeyPolicy.RANDOM_KEY))
            .configureCommandBus(c -> new FluxCapacitorCommandBus(
                    createProducerService(MessageType.COMMAND), c.getComponent(ResultProcessor.class),
                    c.getComponent(AxonMessageSerializer.class),
                    c.getComponent(RoutingStrategy.class), applicationProperties.getClientId(), localCommandBus))
            .registerComponent(FluxCapacitorEventStore.class, this::createEventStore)
            .configureEventStore(c -> c.getComponent(FluxCapacitorEventStore.class))
            .registerModule(new FluxCapacitorModuleConfiguration());
    configurer = configureEventHandling(configurer);
    configurer = configureSagaManagers(configurer);
    return configurer;
}
 
开发者ID:flux-capacitor-io,项目名称:flux-capacitor-client,代码行数:30,代码来源:AbstractFluxCapacitorConfiguration.java

示例4: onApplicationEvent

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
    final ConfigurableApplicationContext context
            = (ConfigurableApplicationContext) event.getSource();
    final List<CommandHandlerInterceptor> interceptors = new ArrayList<>(
            beansOfTypeIncludingAncestors(context.getBeanFactory(),
                    CommandHandlerInterceptor.class).values());
    sort(interceptors);

    for (final SimpleCommandBus commandBus :
            beansOfTypeIncludingAncestors(
            context.getBeanFactory(), SimpleCommandBus.class).values())
        commandBus.setHandlerInterceptors(interceptors);
}
 
开发者ID:binkley,项目名称:axon-spring-boot-starter,代码行数:15,代码来源:CommandHandlerInterceptorAutomation.java

示例5: onApplicationEvent

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
    final ConfigurableApplicationContext context
            = (ConfigurableApplicationContext) event.getSource();
    final List<CommandDispatchInterceptor> interceptors = new ArrayList<>(
            beansOfTypeIncludingAncestors(context.getBeanFactory(),
                    CommandDispatchInterceptor.class).values());
    sort(interceptors);

    for (final SimpleCommandBus commandBus :
            beansOfTypeIncludingAncestors(
            context.getBeanFactory(), SimpleCommandBus.class).values())
        commandBus.setDispatchInterceptors(interceptors);
}
 
开发者ID:binkley,项目名称:axon-spring-boot-starter,代码行数:15,代码来源:CommandDispatchInterceptorAutomation.java

示例6: commandBus

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Produces
@AutoConfigure
@ApplicationScoped
@Qualified
public CommandBus commandBus() {
	return new SimpleCommandBus();
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi-quickstart,代码行数:8,代码来源:AxonQualifiedConfiguration.java

示例7: setUpSuperClass

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@BeforeClass
public static void setUpSuperClass() {
    // let's start with the Command Bus
    commandBus = new SimpleCommandBus();

    // the CommandGateway provides a friendlier API
    commandGateway = new DefaultCommandGateway(commandBus);

    // we'll store Events on the FileSystem, in the "events/" folder
    //EventStore eventStore = new FileSystemEventStore(new JacksonSerializer(), new SimpleEventFileResolver(new File("./events")));
    eventStore = new FileSystemEventStore(new SimpleEventFileResolver(new File("./target/events")));

    // a Simple Event Bus will do
    eventBus = new SimpleEventBus();
}
 
开发者ID:dma-graveyard,项目名称:MaritimeCloudPortalTestbed,代码行数:16,代码来源:AbstractManuallyComnfiguredAxonCqrsIT.java

示例8: localSegmentCommandBus

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public CommandBus localSegmentCommandBus() {
    return new SimpleCommandBus();
}
 
开发者ID:binkley,项目名称:axon-spring-boot-starter,代码行数:6,代码来源:AxonDistributedCommandBusAutoConfiguration.java

示例9: commandBus

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public CommandBus commandBus() {
    return new SimpleCommandBus();
}
 
开发者ID:binkley,项目名称:axon-spring-boot-starter,代码行数:6,代码来源:AxonAutoConfiguration.java

示例10: commandBus

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Bean(name = "localSegment")
public CommandBus commandBus() {
   return new SimpleCommandBus();
}
 
开发者ID:Qyotta,项目名称:axon-eventstore,代码行数:5,代码来源:TestConfiguration.java

示例11: configure

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Autowired
public void configure(@Qualifier("localSegment") SimpleCommandBus simpleCommandBus) {
    simpleCommandBus.registerDispatchInterceptor(new BeanValidationInterceptor<>());
}
 
开发者ID:AxonFramework,项目名称:AxonBank,代码行数:5,代码来源:AxonConfig.java

示例12: commandBus

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@Produces
@AutoConfigure
@ApplicationScoped
public CommandBus commandBus() {
	return new SimpleCommandBus();
}
 
开发者ID:kamaladafrica,项目名称:axon-cdi-quickstart,代码行数:7,代码来源:AxonConfiguration.java

示例13: init

import org.axonframework.commandhandling.SimpleCommandBus; //导入依赖的package包/类
@PostConstruct
public void init () {
	
	commandBus = new SimpleCommandBus();
	
	registerCommandBus(commandBus);
}
 
开发者ID:arturgaleno,项目名称:cqrs-tutorial,代码行数:8,代码来源:CommandGatwayProducer.java


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