According
to http://doc.akka.io/docs/akka-http/10.0.5/java/http/common/json-support.html
we have to use
akka.http.javadsl.marshallers.jackson.Jackson.marshaller(T.class)
But this method does not exists anymore.
akka.http.javadsl.marshallers.jackson.Jackson.marshaller()
akka.http.javadsl.marshallers.jackson.Jackson.marshaller(ObjectMapper o)
Le samedi 29 avril 2017 20:52:12 UTC+2, Thibault Meyer a écrit :
>
> Hello,
>
> I have a blocking operation that I would like to run on the custom
> dispatcher. But I can't return completeWithFuture.
>
> I'm using the latest version of Akka Http on Java 8.
>
>
> public Route createRoute() {
> return route(
> path(PathMatchers.segment("shipment")
> .slash(PathMatchers.segment()), trackingNumber ->
> get(() -> {
> final MessageDispatcher dispatcher = akkaSystem.
> dispatchers().lookup("application.dispatcher");
> final CompletionStage<Integer> c = CompletableFuture.<
> Integer>supplyAsync(() -> 666, dispatcher);
> return completeWithFuture(c, Jackson.<Integer>
> marshaller());
> }))
> )
> );
> }
>
>
>
>
> I get the following compilation error :
>
>
> method akka.http.javadsl.server.directives.RouteDirectives.<T>
> completeWithFuture(scala.concurrent.Future<T>,akka.http.javadsl.
> marshalling.Marshaller<T,akka.http.javadsl.model.HttpResponse>) is not
> applicable
> (cannot infer type-variable(s) T
> (argument mismatch; java.util.concurrent.CompletionStage<java.lang
> .Integer> cannot be converted to scala.concurrent.Future<T>))
> method akka.http.javadsl.server.directives.RouteDirectives.<T>
> completeWithFuture(java.util.concurrent.CompletionStage<T>,akka.http.
> javadsl.marshalling.Marshaller<T,akka.http.javadsl.model.HttpResponse>) is
> not applicable
> (cannot infer type-variable(s) T
> (argument mismatch; akka.http.javadsl.marshalling.Marshaller<java.
> lang.Integer,akka.http.javadsl.model.RequestEntity> cannot be converted
> to akka.http.javadsl.marshalling.Marshaller<T,akka.http.javadsl.model.
> HttpResponse>))
>
>
>
> Thanks
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.