refactor: 리펙토링 진행중 의존성 gradle은 얇게 유지, 각 모듈에서 처리하고 있는 부분에 대해서 리펙토링
This commit is contained in:
-35
@@ -58,14 +58,6 @@ public interface OutboxRepository {
|
||||
List<OutboxLease> claimBatch(
|
||||
String owner, int batchSize, Duration leaseDuration, Instant now, int maxAttempts);
|
||||
|
||||
/**
|
||||
* Marks a record as confirmed by the broker.
|
||||
*
|
||||
* @param messageId the record identity
|
||||
* @param now the current instant
|
||||
*/
|
||||
void markPublished(MessageId messageId, Instant now);
|
||||
|
||||
/**
|
||||
* Records a confirmed publication, only if this lease still owns the row.
|
||||
*
|
||||
@@ -73,17 +65,6 @@ public interface OutboxRepository {
|
||||
*/
|
||||
OutboxTransitionResult markPublished(OutboxLease lease, Instant now);
|
||||
|
||||
/**
|
||||
* Marks a record whose publish outcome is unknown.
|
||||
*
|
||||
* <p>The record stays eligible for retry under the same identity.
|
||||
*
|
||||
* @param messageId the record identity
|
||||
* @param failureCode the sanitized failure code
|
||||
* @param now the current instant
|
||||
*/
|
||||
void markAmbiguous(MessageId messageId, String failureCode, Instant now);
|
||||
|
||||
/** Records an ambiguous outcome, only if this lease still owns the row. */
|
||||
OutboxTransitionResult markAmbiguous(OutboxLease lease, String failureCode, Instant now);
|
||||
|
||||
@@ -99,25 +80,9 @@ public interface OutboxRepository {
|
||||
*/
|
||||
OutboxTransitionResult markExhausted(OutboxLease lease, String reason, Instant now);
|
||||
|
||||
/**
|
||||
* Marks a record the broker definitively rejected.
|
||||
*
|
||||
* @param messageId the record identity
|
||||
* @param failureCode the sanitized failure code
|
||||
* @param now the current instant
|
||||
*/
|
||||
void markFailed(MessageId messageId, String failureCode, Instant now);
|
||||
|
||||
/** Records a terminal failure, only if this lease still owns the row. */
|
||||
OutboxTransitionResult markFailed(OutboxLease lease, String failureCode, Instant now);
|
||||
|
||||
/**
|
||||
* Releases a lease without changing the record's outcome.
|
||||
*
|
||||
* @param messageId the record identity
|
||||
*/
|
||||
void releaseLease(MessageId messageId);
|
||||
|
||||
/** Gives a claim back, only if this lease still owns the row. */
|
||||
OutboxTransitionResult releaseLease(OutboxLease lease);
|
||||
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package dev.caskeleton.messaging.reliability;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import dev.caskeleton.messaging.api.MessageId;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class OutboxRepositoryApiSafetyTest {
|
||||
@Test
|
||||
void outcomeTransitionsDoNotExposeUnfencedMessageIdOverloadsUnderTheSafeNames() {
|
||||
Set<String> fencedNames =
|
||||
Set.of("markPublished", "markAmbiguous", "markFailed", "releaseLease");
|
||||
|
||||
assertThat(OutboxRepository.class.getMethods())
|
||||
.filteredOn(method -> fencedNames.contains(method.getName()))
|
||||
.noneMatch(OutboxRepositoryApiSafetyTest::startsWithMessageId);
|
||||
}
|
||||
|
||||
private static boolean startsWithMessageId(Method method) {
|
||||
return method.getParameterCount() > 0 && method.getParameterTypes()[0] == MessageId.class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user