类 ProducerUtils
java.lang.Object
com.cdkjframework.kafka.producer.util.ProducerUtils
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static void
sendMessageAsync
(String topic, String message) producer 异步方式发送数据static void
sendMessageAsync
(String topic, String key, String message) producer 异步方式发送数据static void
sendMessageSync
(String topic, String message) producer 同步方式发送数据
-
构造器详细资料
-
ProducerUtils
public ProducerUtils()
-
-
方法详细资料
-
sendMessageSync
public static void sendMessageSync(String topic, String message) throws InterruptedException, ExecutionException, TimeoutException producer 同步方式发送数据- 参数:
topic
- topic名称message
- producer发送的数据- 抛出:
InterruptedException
- 异常信息ExecutionException
- 异常信息TimeoutException
- 异常信息
-
sendMessageAsync
public static void sendMessageAsync(String topic, String message) throws ExecutionException, InterruptedException, TimeoutException producer 异步方式发送数据- 参数:
topic
- topic名称message
- producer发送的数据- 抛出:
ExecutionException
InterruptedException
TimeoutException
-
sendMessageAsync
public static void sendMessageAsync(String topic, String key, String message) throws ExecutionException, InterruptedException, TimeoutException producer 异步方式发送数据- 参数:
topic
- topic名称key
- key值message
- producer发送的数据- 抛出:
ExecutionException
InterruptedException
TimeoutException
-