Commit f08ea241 authored by 董建华's avatar 董建华

提交

parent d87d8b7d
......@@ -22,13 +22,13 @@ import java.io.UnsupportedEncodingException;
@Slf4j
public class UserEventCollectingUtil {
private static final MyCallBack<UserRecordResult> CALL_BACK = new MyCallBack<>();
public static void addEvent(EventInfo eventInfo) {
KinesisProducerClient client = KinesisProducerClientFactory.getClient();
try {
MyCallBack<UserRecordResult> CallBack = new MyCallBack<>(eventInfo);
ListenableFuture<UserRecordResult> future = client.SendRecord(eventInfo);
Futures.addCallback(future, CallBack);
Futures.addCallback(future, CALL_BACK);
} catch (UnsupportedEncodingException e) {
log.error("发送事件异常UnsupportedEncodingException:{}", e);
} catch (Exception e) {
......@@ -39,15 +39,9 @@ public class UserEventCollectingUtil {
@Slf4j
public static class MyCallBack<UserRecordResult> implements FutureCallback<UserRecordResult> {
private EventInfo eventInfo;
public MyCallBack(EventInfo eventInfo) {
this.eventInfo = eventInfo;
}
@Override
public void onSuccess(@Nullable UserRecordResult userRecordResult) {
log.info("发送事件成功 o:{},eventInfo:{}", JSON.toJSONString(userRecordResult), eventInfo);
log.info("发送事件成功 o:{}", JSON.toJSONString(userRecordResult));
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment