Skip to content

Commit

Permalink
PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
schananas committed Feb 9, 2022
1 parent 27e388c commit f6f6011
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 80 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -118,12 +118,7 @@ public AxonServerCommandBus(Builder builder) {
this.loadFactorProvider = builder.loadFactorProvider;


String context;
if (StringUtils.nonEmptyOrNull(builder.defaultContext)) {
context = builder.defaultContext;
} else {
context = configuration.getContext();
}
String context = StringUtils.nonEmptyOrNull(builder.defaultContext) ? builder.defaultContext : configuration.getContext();

this.context = context;
this.targetContextResolver = builder.targetContextResolver.orElse(m -> context);
Expand Down Expand Up @@ -471,7 +466,7 @@ public Builder loadFactorProvider(CommandLoadFactorProvider loadFactorProvider)
}

/**
* Sets the default context for this event store to connect to.
* Sets the default context for this command bus to connect to.
*
* @param defaultContext for this bus to connect to.
* @return the current Builder instance, for fluent interfacing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2021. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,6 +76,7 @@
import java.util.stream.StreamSupport;

import static java.util.Spliterator.*;
import static org.axonframework.common.BuilderUtils.assertNonEmpty;
import static org.axonframework.common.BuilderUtils.assertNonNull;
import static org.axonframework.common.ObjectUtils.getOrDefault;

Expand Down Expand Up @@ -268,7 +269,7 @@ public Builder eventSerializer(Serializer eventSerializer) {
* @return the current Builder instance, for fluent interfacing
*/
public Builder defaultContext(String defaultContext) {
assertNonNull(defaultContext, "The default context may not be null");
assertNonEmpty(defaultContext, "The default context may not be null");
this.defaultContext = defaultContext;
return this;
}
Expand Down Expand Up @@ -362,12 +363,12 @@ private void buildStorageEngine() {
"The PlatformConnectionManager is a hard requirement and should be provided");

super.storageEngine(AxonIQEventStorageEngine.builder()
.snapshotSerializer(snapshotSerializer.get())
.upcasterChain(upcasterChain)
.snapshotFilter(snapshotFilter)
.eventSerializer(eventSerializer.get())
.configuration(configuration)
.defaultContext(defaultContext)
.snapshotSerializer(snapshotSerializer.get())
.upcasterChain(upcasterChain)
.snapshotFilter(snapshotFilter)
.eventSerializer(eventSerializer.get())
.configuration(configuration)
.defaultContext(defaultContext)
.eventStoreClient(axonServerConnectionManager)
.converter(new GrpcMetaDataConverter(eventSerializer.get()))
.build());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,8 +33,10 @@
* EventProcessor}s with AxonServer.
*
* @author Sara Pellegrini
* @deprecated because {@link EventProcessorControlService} is lifecycle aware
* @since 4.0
*/
@Deprecated
public class EventProcessorInfoConfiguration implements ModuleConfiguration {

private final Component<EventProcessorControlService> eventProcessorControlService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -136,11 +136,7 @@ public AxonServerQueryBus(Builder builder) {
this.serializer = builder.buildQuerySerializer();
this.subscriptionSerializer = builder.buildSubscriptionMessageSerializer();
this.priorityCalculator = builder.priorityCalculator;
if (StringUtils.nonEmptyOrNull(builder.defaultContext)) {
this.context = builder.defaultContext;
} else {
this.context = configuration.getContext();
}
this.context = StringUtils.nonEmptyOrNull(builder.defaultContext) ? builder.defaultContext : configuration.getContext();
this.targetContextResolver = builder.targetContextResolver.orElse(m -> context);

dispatchInterceptors = new DispatchInterceptors<>();
Expand Down
12 changes: 1 addition & 11 deletions config/src/main/java/org/axonframework/config/Configurer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2021. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +39,6 @@
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;

/**
* Entry point of the Axon Configuration API.
Expand Down Expand Up @@ -531,15 +530,6 @@ default Configurer registerEventHandler(Function<Configuration, Object> eventHan
return this;
}

default <MC extends ModuleConfiguration> MC getModuleConfiguration(Class<MC> clazz) {
throw new UnsupportedOperationException();
}

default <MC extends ModuleConfiguration> MC getModuleConfiguration(Class<MC> clazz,
Supplier<MC> defaultModuleConfiguration) {
throw new UnsupportedOperationException();
}

/**
* Configures the timeout of each lifecycle phase. The Configurer invokes lifecycle phases during start-up and
* shutdown of an application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2021. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -260,8 +260,6 @@ EventProcessingConfigurer registerTokenStore(String processorName,
*/
EventProcessingConfigurer usingPooledStreamingEventProcessors();

EventProcessingConfigurer usingEventProcessorBuilder(EventProcessorBuilder processorBuilder);

/**
* Registers a {@link org.axonframework.eventhandling.SubscribingEventProcessor} with given {@code name} within this
* Configurer.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2021. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -567,10 +567,6 @@ name, eventHandlerInvoker, trackingEventProcessorConfig(name), defaultStreamable
return this;
}

public EventProcessingConfigurer usingEventProcessorBuilder(EventProcessorBuilder processorBuilder) {
this.defaultEventProcessorBuilder = processorBuilder;
return this;
}

@Override
public EventProcessingConfigurer usingPooledStreamingEventProcessors() {
Expand Down Expand Up @@ -780,10 +776,12 @@ private TrackingEventProcessorConfiguration trackingEventProcessorConfig(String
}

/**
* @param name
* @param eventHandlerInvoker
* @param messageSource
* @return
* Default {@link SubscribingEventProcessor} configuration based on this configure module.
*
* @param name of the processor
* @param eventHandlerInvoker used by the processor for the vent handling
* @param messageSource where to retrieve events from
* @return Default {@link SubscribingEventProcessor} configuration based on this configure module.
*/
protected EventProcessor subscribingEventProcessor(String name,
EventHandlerInvoker eventHandlerInvoker,
Expand All @@ -800,6 +798,15 @@ protected EventProcessor subscribingEventProcessor(String name,
.build();
}

/**
* Default {@link TrackingEventProcessor} configuration based on this configure module.
*
* @param name of the processor
* @param eventHandlerInvoker used by the processor for the event handling
* @param config for the tracking event processor construction
* @param source where to retrieve events from
* @return Default {@link TrackingEventProcessor} configuration based on this configure module.
*/
protected EventProcessor trackingEventProcessor(String name,
EventHandlerInvoker eventHandlerInvoker,
TrackingEventProcessorConfiguration config,
Expand All @@ -817,6 +824,16 @@ protected EventProcessor trackingEventProcessor(String name,
.build();
}

/**
* Default {@link PooledStreamingEventProcessor} configuration based on this configure module.
*
* @param name of the processor
* @param eventHandlerInvoker used by the processor for the event handling
* @param config main configuration providing access for Axon components
* @param messageSource where to retrieve events from
* @param processorConfiguration for the pooled event processor construction
* @return Default {@link PooledStreamingEventProcessor} configuration based on this configure module.
*/
protected EventProcessor pooledStreamingEventProcessor(
String name,
EventHandlerInvoker eventHandlerInvoker,
Expand Down
26 changes: 0 additions & 26 deletions database.trace.db

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
import org.axonframework.axonserver.connector.command.CommandLoadFactorProvider;
import org.axonframework.axonserver.connector.command.CommandPriorityCalculator;
import org.axonframework.axonserver.connector.event.axon.AxonServerEventScheduler;
import org.axonframework.axonserver.connector.event.axon.EventProcessorInfoConfiguration;
import org.axonframework.axonserver.connector.processor.EventProcessorControlService;
import org.axonframework.axonserver.connector.query.QueryPriorityCalculator;
import org.axonframework.commandhandling.distributed.AnnotationRoutingStrategy;
import org.axonframework.commandhandling.distributed.RoutingStrategy;
Expand All @@ -40,6 +40,7 @@
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -135,17 +136,15 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
}

@Bean
@ConditionalOnMissingClass("org.axonframework.extensions.multitenancy.autoconfig.MultiTenancyAxonServerAutoConfiguration")
@ConditionalOnMissingBean
public EventProcessorInfoConfiguration processorInfoConfiguration(
public EventProcessorControlService eventProcessorControlService(
EventProcessingConfiguration eventProcessingConfiguration,
AxonServerConnectionManager connectionManager,
AxonServerConfiguration configuration) {
return new EventProcessorInfoConfiguration(c -> eventProcessingConfiguration,
c -> connectionManager,
c -> configuration);
return new EventProcessorControlService(connectionManager,eventProcessingConfiguration,configuration);
}


@Bean
@ConditionalOnMissingBean
public EventScheduler eventScheduler(@Qualifier("eventSerializer") Serializer eventSerializer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2020. Axon Framework
* Copyright (c) 2010-2022. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down

0 comments on commit f6f6011

Please sign in to comment.