增加MessageProducer.sendDelayMessage接口

This commit is contained in:
redkale
2024-11-09 19:02:21 +08:00
parent 6401c74f10
commit f700743134
2 changed files with 13 additions and 15 deletions

View File

@@ -4,7 +4,6 @@
package org.redkale.mq; package org.redkale.mq;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.time.Duration;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import org.redkale.convert.Convert; import org.redkale.convert.Convert;
@@ -64,27 +63,27 @@ public interface MessageProducer {
} }
public CompletableFuture<Void> sendDelayMessage( public CompletableFuture<Void> sendDelayMessage(
String topic, Integer partition, Duration delay, Convert convert, Type type, Object value); String topic, Integer partition, int delaySeconds, Convert convert, Type type, Object value);
default CompletableFuture<Void> sendDelayMessage( default CompletableFuture<Void> sendDelayMessage(
String topic, Integer partition, Duration delay, Convert convert, Object value) { String topic, Integer partition, int delaySeconds, Convert convert, Object value) {
return sendDelayMessage(topic, partition, delay, convert, (Type) null, value); return sendDelayMessage(topic, partition, delaySeconds, convert, (Type) null, value);
} }
default CompletableFuture<Void> sendDelayMessage(String topic, Integer partition, Duration delay, Object value) { default CompletableFuture<Void> sendDelayMessage(String topic, Integer partition, int delaySeconds, Object value) {
return sendDelayMessage(topic, partition, delay, (Convert) null, (Type) null, value); return sendDelayMessage(topic, partition, delaySeconds, (Convert) null, (Type) null, value);
} }
default CompletableFuture<Void> sendDelayMessage( default CompletableFuture<Void> sendDelayMessage(
String topic, Duration delay, Convert convert, Type type, Object value) { String topic, int delaySeconds, Convert convert, Type type, Object value) {
return sendDelayMessage(topic, (Integer) null, delay, convert, type, value); return sendDelayMessage(topic, (Integer) null, delaySeconds, convert, type, value);
} }
default CompletableFuture<Void> sendDelayMessage(String topic, Duration delay, Convert convert, Object value) { default CompletableFuture<Void> sendDelayMessage(String topic, int delaySeconds, Convert convert, Object value) {
return sendDelayMessage(topic, (Integer) null, delay, convert, (Type) null, value); return sendDelayMessage(topic, (Integer) null, delaySeconds, convert, (Type) null, value);
} }
default CompletableFuture<Void> sendDelayMessage(String topic, Duration delay, Object value) { default CompletableFuture<Void> sendDelayMessage(String topic, int delaySeconds, Object value) {
return sendDelayMessage(topic, (Integer) null, delay, (Convert) null, (Type) null, value); return sendDelayMessage(topic, (Integer) null, delaySeconds, (Convert) null, (Type) null, value);
} }
} }

View File

@@ -7,7 +7,6 @@ package org.redkale.mq.spi;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.time.Duration;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@@ -640,9 +639,9 @@ public abstract class MessageAgent implements MessageManager {
@Override @Override
public CompletableFuture<Void> sendDelayMessage( public CompletableFuture<Void> sendDelayMessage(
String topic, Integer partition, Duration delay, Convert convert0, Type type, Object value) { String topic, Integer partition, int delaySeconds, Convert convert0, Type type, Object value) {
return producer.sendDelayMessage( return producer.sendDelayMessage(
topic, partition, delay, convert0 == null ? this.convert : convert0, type, value); topic, partition, delaySeconds, convert0 == null ? this.convert : convert0, type, value);
} }
} }
} }