use of software.amazon.awssdk.eventstreamrpc.OperationModelContext in project aws-iot-device-sdk-java-v2 by aws.
the class TestIpcServiceHandler method getOperationHandler.
@Override
public Function<OperationContinuationHandlerContext, ? extends ServerConnectionContinuationHandler> getOperationHandler(final String operationName) {
final EventStreamRPCServiceModel svcModel = this.serviceModel;
System.out.println("Operation handler retrieved for operation name: " + operationName);
return (context) -> {
final TestOperationContinuationHandler handler = new TestOperationContinuationHandler(context) {
@Override
public OperationModelContext getOperationModelContext() {
return svcModel.getOperationModelContext(operationName);
}
@Override
protected void onStreamClosed() {
streamClosed = true;
}
@Override
public EventStreamJsonMessage handleRequest(EventStreamJsonMessage request) {
System.out.println("Handling request...");
return requestHandler.apply(request);
}
@Override
public void handleStreamEvent(EventStreamJsonMessage streamRequestEvent) {
System.out.println("Handling request stream event...");
}
};
continuationHandlerQueue.offer(new AbstractMap.SimpleImmutableEntry<>(operationName, handler));
return handler;
};
}
Aggregations