Search in sources :

Example 1 with JsonRpcResponse

use of com.alibaba.spring.boot.rsocket.broker.cluster.jsonrpc.JsonRpcResponse in project alibaba-rsocket-broker by alibaba.

the class RSocketBrokerManagerGossipImpl method makeJsonRpcCall.

public Mono<JsonRpcResponse> makeJsonRpcCall(@NotNull Member member, @NotNull String methodName, @Nullable Object params) {
    String uuid = UUID.randomUUID().toString();
    Message jsonRpcMessage = Message.builder().correlationId(uuid).header("jsonrpc", "2.0").data(new JsonRpcRequest(methodName, params, uuid)).build();
    return monoCluster.flatMap(cluster -> cluster.requestResponse(member, jsonRpcMessage)).map(Message::data);
}
Also used : Sinks(reactor.core.publisher.Sinks) java.util(java.util) Json(com.alibaba.rsocket.cloudevents.Json) Cluster(io.scalecube.cluster.Cluster) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) JsonRpcResponse(com.alibaba.spring.boot.rsocket.broker.cluster.jsonrpc.JsonRpcResponse) Metrics(io.micrometer.core.instrument.Metrics) Value(org.springframework.beans.factory.annotation.Value) Shutdown(org.springframework.boot.web.server.Shutdown) CloudEventImpl(com.alibaba.rsocket.cloudevents.CloudEventImpl) RSocketFilterEnableEvent(com.alibaba.spring.boot.rsocket.broker.events.RSocketFilterEnableEvent) Message(io.scalecube.cluster.transport.api.Message) JsonRpcRequest(com.alibaba.spring.boot.rsocket.broker.cluster.jsonrpc.JsonRpcRequest) ClusterImpl(io.scalecube.cluster.ClusterImpl) ServerProperties(org.springframework.boot.autoconfigure.web.ServerProperties) DoubleFunction(org.eclipse.collections.api.block.function.primitive.DoubleFunction) Address(io.scalecube.net.Address) Logger(org.slf4j.Logger) RsocketErrorCode(com.alibaba.rsocket.observability.RsocketErrorCode) Mono(reactor.core.publisher.Mono) GracefulShutdownResult(org.springframework.boot.web.server.GracefulShutdownResult) ApplicationContext(org.springframework.context.ApplicationContext) Collectors(java.util.stream.Collectors) SmartLifecycle(org.springframework.context.SmartLifecycle) RSocketFilter(com.alibaba.rsocket.route.RSocketFilter) Nullable(org.jetbrains.annotations.Nullable) Flux(reactor.core.publisher.Flux) Stream(java.util.stream.Stream) RSocketBrokerProperties(com.alibaba.spring.boot.rsocket.broker.RSocketBrokerProperties) Member(io.scalecube.cluster.Member) MembershipEvent(io.scalecube.cluster.membership.MembershipEvent) NetworkUtil(com.alibaba.rsocket.transport.NetworkUtil) TcpTransportFactory(io.scalecube.transport.netty.tcp.TcpTransportFactory) ClusterMessageHandler(io.scalecube.cluster.ClusterMessageHandler) NotNull(org.jetbrains.annotations.NotNull) ServiceLocator(com.alibaba.rsocket.ServiceLocator) GracefulShutdownCallback(org.springframework.boot.web.server.GracefulShutdownCallback) Message(io.scalecube.cluster.transport.api.Message) JsonRpcRequest(com.alibaba.spring.boot.rsocket.broker.cluster.jsonrpc.JsonRpcRequest)

Aggregations

ServiceLocator (com.alibaba.rsocket.ServiceLocator)1 CloudEventImpl (com.alibaba.rsocket.cloudevents.CloudEventImpl)1 Json (com.alibaba.rsocket.cloudevents.Json)1 RsocketErrorCode (com.alibaba.rsocket.observability.RsocketErrorCode)1 RSocketFilter (com.alibaba.rsocket.route.RSocketFilter)1 NetworkUtil (com.alibaba.rsocket.transport.NetworkUtil)1 RSocketBrokerProperties (com.alibaba.spring.boot.rsocket.broker.RSocketBrokerProperties)1 JsonRpcRequest (com.alibaba.spring.boot.rsocket.broker.cluster.jsonrpc.JsonRpcRequest)1 JsonRpcResponse (com.alibaba.spring.boot.rsocket.broker.cluster.jsonrpc.JsonRpcResponse)1 RSocketFilterEnableEvent (com.alibaba.spring.boot.rsocket.broker.events.RSocketFilterEnableEvent)1 Metrics (io.micrometer.core.instrument.Metrics)1 Cluster (io.scalecube.cluster.Cluster)1 ClusterImpl (io.scalecube.cluster.ClusterImpl)1 ClusterMessageHandler (io.scalecube.cluster.ClusterMessageHandler)1 Member (io.scalecube.cluster.Member)1 MembershipEvent (io.scalecube.cluster.membership.MembershipEvent)1 Message (io.scalecube.cluster.transport.api.Message)1 Address (io.scalecube.net.Address)1 TcpTransportFactory (io.scalecube.transport.netty.tcp.TcpTransportFactory)1 java.util (java.util)1