Reactive FunctionClients
@FunctionClient
interfaces support RxJava constructs, so the above interfaces could be implemented as shown below:
RxMathClient
import io.micronaut.runtime.server.EmbeddedServer;
import io.micronaut.function.client.FunctionClient;
import org.junit.Test;
import javax.inject.Named;
import static org.junit.Assert.assertEquals;
import io.reactivex.Single;
import java.util.Collections;
@FunctionClient
interface RxMathClient {
Single<Long> max();
@Named("round")
Single<Integer> rnd(float value);
Single<Long> sum(Sum sum);
}
RxMathClient
import io.micronaut.function.client.FunctionClient
import javax.inject.Named
import io.reactivex.Single
@FunctionClient
static interface RxMathClient {
Single<Long> max()
@Named("round")
Single<Integer> rnd(float value)
Single<Long> sum(Sum sum)
}
RxMathClient
import io.kotlintest.shouldBe
import io.kotlintest.specs.StringSpec
import io.micronaut.context.ApplicationContext
import io.micronaut.runtime.server.EmbeddedServer
import io.micronaut.function.client.FunctionClient
import io.micronaut.http.client.RxHttpClient
import javax.inject.Named
import io.reactivex.Single
@FunctionClient
internal interface RxMathClient {
fun max(): Single<Long>
@Named("round")
fun rnd(value: Float): Single<Int>
fun sum(sum: Sum): Single<Long>
}