com.github.linyuzai.connection.loadbalance.sse.reactive.ReactiveSseConnection Maven / Gradle / Ivy
The newest version!
package com.github.linyuzai.connection.loadbalance.sse.reactive;
import com.github.linyuzai.connection.loadbalance.core.message.MessageTransportException;
import com.github.linyuzai.connection.loadbalance.sse.concept.SseConnection;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.web.reactive.function.client.WebClientException;
import reactor.core.publisher.FluxSink;
import java.util.function.Consumer;
@Getter
@RequiredArgsConstructor
public class ReactiveSseConnection extends SseConnection {
private final FluxSink> fluxSink;
@SuppressWarnings("unchecked")
@Override
public void doSend(Object message, Runnable onSuccess, Consumer onError, Runnable onComplete) {
try {
if (message instanceof ServerSentEvent) {
fluxSink.next((ServerSentEvent
© 2015 - 2024 Weber Informatics LLC | Privacy Policy