This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #871 from zalando/ARUHA-1636
aruha-1636: unlimited retention time by Nakadi admin
- Loading branch information
Showing
11 changed files
with
140 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/org/zalando/nakadi/exceptions/runtime/EventTypeOptionsValidationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.zalando.nakadi.exceptions.runtime; | ||
|
||
public class EventTypeOptionsValidationException extends MyNakadiRuntimeException1 { | ||
|
||
public EventTypeOptionsValidationException(final String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/org/zalando/nakadi/service/validation/EventTypeOptionsValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.zalando.nakadi.service.validation; | ||
|
||
import org.zalando.nakadi.domain.EventTypeOptions; | ||
import org.zalando.nakadi.exceptions.runtime.EventTypeOptionsValidationException; | ||
|
||
public final class EventTypeOptionsValidator { | ||
|
||
private final long minTopicRetentionMs; | ||
private final long maxTopicRetentionMs; | ||
|
||
public EventTypeOptionsValidator(final long minTopicRetentionMs, | ||
final long maxTopicRetentionMs) { | ||
this.minTopicRetentionMs = minTopicRetentionMs; | ||
this.maxTopicRetentionMs = maxTopicRetentionMs; | ||
} | ||
|
||
public void checkRetentionTime(final EventTypeOptions options) throws EventTypeOptionsValidationException { | ||
if (options == null) { | ||
return; | ||
} | ||
|
||
final Long retentionTime = options.getRetentionTime(); | ||
if (retentionTime != null) { | ||
if (retentionTime > maxTopicRetentionMs) { | ||
throw new EventTypeOptionsValidationException( | ||
"Field \"options.retention_time\" can not be more than " + maxTopicRetentionMs); | ||
} else if (retentionTime < minTopicRetentionMs) { | ||
throw new EventTypeOptionsValidationException( | ||
"Field \"options.retention_time\" can not be less than " + minTopicRetentionMs); | ||
} | ||
} | ||
} | ||
|
||
} |
47 changes: 0 additions & 47 deletions
47
src/main/java/org/zalando/nakadi/validation/EventTypeOptionsValidator.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.