Witam chce nauczyć się frameworka Lagom. Do nauki wykorzystuje dokumentację.
Próbuje odpalić przykład hello world z dokumentacji
https://www.lagomframework.com/documentation/1.4.x/java/GettingStartedMaven.html
Serwer normalnie startuje ale gdy przechodzę pod adres
http://localhost:9000/api/hello/World
Dostaje błąd
Action Not Found
Tak wygląda zawartość
@Value
@JsonDeserialize
public final class GreetingMessage {
public final String message;
@JsonCreator
public GreetingMessage(String message) {
this.message = Preconditions.checkNotNull(message, "message");
}
}
/**
* The Hello service interface.
* <p>
* This describes everything that Lagom needs to know about how to serve and
* consume the Hello.
*/
public interface HelloService extends Service {
/**
* Example: curl http://localhost:9000/api/hello/Alice
*/
ServiceCall<NotUsed, String> hello(String id);
/**
* Example: curl -H "Content-Type: application/json" -X POST -d '{"message":
* "Hi"}' http://localhost:9000/api/hello/Alice
*/
ServiceCall<GreetingMessage, Done> useGreeting(String id);
/**
* This gets published to Kafka.
*/
Topic<HelloEvent> helloEvents();
@Override
default Descriptor descriptor() {
// @formatter:off
return named("hello").withCalls(
pathCall("/api/hello/:id", this::hello),
pathCall("/api/hello/:id", this::useGreeting)
).withTopics(
topic("hello-events", this::helloEvents)
// Kafka partitions messages, messages within the same partition will
// be delivered in order, to ensure that all messages for the same user
// go to the same partition (and hence are delivered in order with respect
// to that user), we configure a partition key strategy that extracts the
// name as the partition key.
.withProperty(KafkaProperties.partitionKeyStrategy(), HelloEvent::getName)
).withAutoAcl(true);
// @formatter:on
}
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value = HelloEvent.GreetingMessageChanged.class, name = "greeting-message-changed")
})
public interface HelloEvent {
String getName();
@Value
final class GreetingMessageChanged implements HelloEvent {
public final String name;
public final String message;
@JsonCreator
public GreetingMessageChanged(String name, String message) {
this.name = Preconditions.checkNotNull(name, "name");
this.message = Preconditions.checkNotNull(message, "message");
}
}
}
W jaki sposób uruchomić hello? Wydawało mi się raczej, że taki przykład powinien działać bez problemu ? A może to problem z systemem ? korzystam z Linux Mint.
Pozdrawiam.