mghildiy
(Mghildiy)
October 20, 2018, 1:11pm
1
I am following this .
In my code, I have following
pathCall(“/api/hello/:id”, this::hello),
pathCall(“/api/hello/:id”, this::useGreeting),
restCall(Method.GET, "/api/getEmpData?id, this::getData)
getData is defined as:
ServiceCall<NotUsed,Source<String,?>>getEmpData(String id);
This gives me error:
Cannot resolve method ‘restCall(com.lightbend.lagom.javadsl.api.transport.Method, java.lang.String, )’
What is causing this?
aklikic
(Alan Klikic)
October 20, 2018, 3:35pm
2
@mghildiy i do not think you can use restCall with GET method for websocket connection.
You should use namedCall or pathCall.
I do not know if it was your intention or not but using Source in request and/or response of a ServiceCall will indicate Lagom to use websocket as an underlying protocol.
mghildiy
(Mghildiy)
October 20, 2018, 3:48pm
3
Hi,
Thanks for the reply.
In link I posted, restCall is used with GET, as:
restCall(Method.GET, “/order/:orderId/item/:itemId”, this::getItem)
I am also trying to do same.
aklikic
(Alan Klikic)
October 20, 2018, 5:35pm
4
In the example reaponse is not a Source<String,?> but Item
mghildiy
(Mghildiy)
October 20, 2018, 5:37pm
5
So does it mean Lagom doesn’t allow streaming via a REST GET API?
aklikic
(Alan Klikic)
October 20, 2018, 5:39pm
6
It does but you should use namedCall or pathCall instead of restCall with GET
1 Like