Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
import cloudflow.streamlets.StreamletShape;
import cloudflow.streamlets.proto.javadsl.ProtoInlet;

import scala.Option;
import sensordata.grpc.SensorData;

public class Logger extends AkkaStreamlet {
private final ProtoInlet<SensorData> inlet = new ProtoInlet<SensorData>(
"in",
SensorData.class,
true
);
private final ProtoInlet<SensorData> inlet = (ProtoInlet<SensorData>) ProtoInlet.create("in", SensorData.class)
.withErrorHandler((inBytes, throwable) -> {
context().system().log().error(String.format("an exception occurred on inlet: %s -> (hex string) %h", throwable.getMessage(), inBytes));
return Option.apply(null); // skip the element
}
);

@Override
public StreamletShape shape() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

//end::logic[]

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletionStage;

Expand All @@ -40,9 +41,9 @@ public StreamletShape shape() {
public AkkaStreamletLogic createLogic() {
return new GrpcServerLogic(this, getContext()) {
public List<Function<HttpRequest, CompletionStage<HttpResponse>>> handlers() {
return List.of(
return Arrays.asList(
SensorDataServiceHandlerFactory.partial(new SensorDataServiceImpl(sinkRef(out)), SensorDataService.name, system()),
ServerReflection.create(List.of(SensorDataService.description), system()));
ServerReflection.create(Arrays.asList(SensorDataService.description), system()));
}
};
}
Expand Down