Skip to content

Commit

Permalink
Changes needed for 4.9.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerard Klijs committed Oct 24, 2023
1 parent a35dd79 commit d1013f2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jobrunrpro-spring-boot-3-integrationtests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<properties>
<jobrunr.version>6.0.0</jobrunr.version>
<axon.version>4.8.0</axon.version>
<axon.version>4.9.0</axon.version>
<jococo.version>0.8.8</jococo.version>
<testcontainers.version>1.19.1</testcontainers.version>
</properties>
Expand Down
5 changes: 5 additions & 0 deletions jobrunrpro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.axonframework.common.transaction.NoTransactionManager;
import org.axonframework.common.transaction.TransactionManager;
import org.axonframework.deadline.DeadlineManager;
import org.axonframework.deadline.DeadlineManagerSpanFactory;
import org.axonframework.deadline.DefaultDeadlineManagerSpanFactory;
import org.axonframework.deadline.jobrunr.DeadlineDetails;
import org.axonframework.deadline.jobrunr.JobRunrDeadlineManager;
import org.axonframework.deadline.quartz.QuartzDeadlineManager;
Expand Down Expand Up @@ -51,7 +53,7 @@ public class JobRunrProDeadlineManager extends JobRunrDeadlineManager {
protected final JobScheduler jobScheduler;
private final StorageProvider storageProvider;
private final Serializer serializer;
private final SpanFactory spanFactory;
private final DeadlineManagerSpanFactory spanFactory;

/**
* Instantiate a Builder to be able to create a {@link JobRunrProDeadlineManager}.
Expand Down Expand Up @@ -94,14 +96,13 @@ protected String getSpanClassName() {

@Override
public void cancelAll(@Nonnull String deadlineName) {
Span span = spanFactory.createInternalSpan(() -> getSpanClassName() + ".cancelAll(" + deadlineName + ")");
Span span = spanFactory.createCancelAllSpan(deadlineName);
runOnPrepareCommitOrNow(span.wrapRunnable(() -> deleteAll(getLabel(deadlineName))));
}

@Override
public void cancelAllWithinScope(@Nonnull String deadlineName, @Nonnull ScopeDescriptor scope) {
Span span = spanFactory.createInternalSpan(
() -> getSpanClassName() + ".cancelAllWithinScope(" + deadlineName + ")");
Span span = spanFactory.createCancelAllWithinScopeSpan(deadlineName, scope);
runOnPrepareCommitOrNow(span.wrapRunnable(() -> deleteAll(getCombinedLabel(serializer, deadlineName, scope))));
}

Expand All @@ -125,7 +126,9 @@ public static class Builder {
private ScopeAwareProvider scopeAwareProvider;
private Serializer serializer;
private TransactionManager transactionManager = NoTransactionManager.INSTANCE;
private SpanFactory spanFactory = NoOpSpanFactory.INSTANCE;
private DeadlineManagerSpanFactory spanFactory = DefaultDeadlineManagerSpanFactory.builder()
.spanFactory(NoOpSpanFactory.INSTANCE)
.build();

/**
* Sets the {@link JobScheduler} used for scheduling and triggering purposes of the deadlines.
Expand Down Expand Up @@ -201,8 +204,23 @@ public Builder transactionManager(TransactionManager transactionManager) {
*
* @param spanFactory The {@link SpanFactory} implementation
* @return The current Builder instance, for fluent interfacing.
* @deprecated Use {@link #spanFactory(DeadlineManagerSpanFactory)} instead as it provides more configuration options.
*/
public Builder spanFactory(@Nonnull SpanFactory spanFactory) {
assertNonNull(spanFactory, "SpanFactory may not be null");
this.spanFactory = DefaultDeadlineManagerSpanFactory.builder().spanFactory(spanFactory).build();
return this;
}

/**
* Sets the {@link DeadlineManagerSpanFactory} implementation to use for providing tracing capabilities.
* Defaults to a {@link DefaultDeadlineManagerSpanFactory} backed by a {@link NoOpSpanFactory} by default, which
* provides no tracing capabilities.
*
* @param spanFactory The {@link DeadlineManagerSpanFactory} implementation
* @return The current Builder instance, for fluent interfacing.
*/
public Builder spanFactory(@Nonnull DeadlineManagerSpanFactory spanFactory) {
assertNonNull(spanFactory, "SpanFactory may not be null");
this.spanFactory = spanFactory;
return this;
Expand Down

0 comments on commit d1013f2

Please sign in to comment.