Created
November 6, 2022 18:26
-
-
Save marttp/0677fcc11cdaa943982ee1ab19a86085 to your computer and use it in GitHub Desktop.
ClientInterfaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dev.tpcoder.bffjav.client; | |
import dev.tpcoder.bffjav.model.Driver; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.codec.multipart.FilePart; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.PostMapping; | |
import org.springframework.web.bind.annotation.RequestBody; | |
import org.springframework.web.bind.annotation.RequestPart; | |
import org.springframework.web.service.annotation.GetExchange; | |
import org.springframework.web.service.annotation.HttpExchange; | |
import org.springframework.web.service.annotation.PostExchange; | |
import reactor.core.publisher.Flux; | |
import reactor.core.publisher.Mono; | |
@HttpExchange(url = "/drivers", accept = MediaType.APPLICATION_JSON_VALUE) | |
public interface DriverClient { | |
@GetExchange | |
Flux<Driver> getAll(); | |
@GetExchange("/{id}") | |
Mono<Driver> getById(@PathVariable String id); | |
@PostExchange | |
Mono<Void> create(@RequestBody Driver driver); | |
@PostExchange(value = "/form", contentType = MediaType.MULTIPART_FORM_DATA_VALUE) | |
Mono<Void> form(@RequestPart String name, @RequestPart FilePart filePart); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dev.tpcoder.bffjav.client; | |
import dev.tpcoder.bffjav.model.Location; | |
import org.springframework.messaging.handler.annotation.DestinationVariable; | |
import org.springframework.messaging.handler.annotation.Payload; | |
import org.springframework.messaging.rsocket.service.RSocketExchange; | |
import reactor.core.publisher.Flux; | |
import reactor.core.publisher.Mono; | |
public interface LocationClient { | |
@RSocketExchange("locations.{driver}") | |
Flux<Location> trackingLocation(@DestinationVariable String driver); | |
@RSocketExchange("collectLocation") | |
Mono<Void> submitLocation(@Payload Location body); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment