public class SseEmitter
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected java.lang.Runnable |
onCompletion |
protected java.util.function.Consumer<java.lang.Throwable> |
onError |
protected ConsumerEx<SseEmitter> |
onInited |
protected java.lang.Runnable |
onTimeout |
protected long |
timeout |
构造器和说明 |
---|
SseEmitter(long timeout)
超时(用于异步超时)
|
限定符和类型 | 方法和说明 |
---|---|
void |
complete()
完成(用于手动控制)
|
protected void |
initialize(SseEmitterHandler handler)
初始化
|
SseEmitter |
onCompletion(java.lang.Runnable onCompletion)
完成回调方法
|
SseEmitter |
onError(java.util.function.Consumer<java.lang.Throwable> onError)
异常回调方法
|
SseEmitter |
onInited(ConsumerEx<SseEmitter> onInited)
初始化回调方法
|
SseEmitter |
onTimeout(java.lang.Runnable onTimeout)
超时回调方法
|
void |
send(SseEvent event)
发送事件
|
void |
send(java.lang.String data)
发送事件内容
|
protected java.lang.Runnable onCompletion
protected java.lang.Runnable onTimeout
protected java.util.function.Consumer<java.lang.Throwable> onError
protected ConsumerEx<SseEmitter> onInited
protected long timeout
public SseEmitter onCompletion(java.lang.Runnable onCompletion)
public SseEmitter onTimeout(java.lang.Runnable onTimeout)
public SseEmitter onError(java.util.function.Consumer<java.lang.Throwable> onError)
public SseEmitter onInited(ConsumerEx<SseEmitter> onInited)
public void send(java.lang.String data) throws java.io.IOException
data
- 事件数据java.io.IOException
public void send(SseEvent event) throws java.io.IOException
event
- 事件数据java.io.IOException
public void complete()
protected void initialize(SseEmitterHandler handler) throws java.lang.Throwable
java.lang.Throwable