-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various Rpc & Transport API Enhancements (#60)
* Various Rpc & Transport API Enhancements The following change fixes the RpcClient, uTransport interfaces to have callbacks not returning a value, to support UMessage as passed parameters to the various APIs. This Change also introduces RpcServer interface that uServices call to register a Rpc request listener to handle RPC requests. #53 * More cleanup * Add header and make responses CompletableFutures * Remove uSubscription.java * Fix isExpired() * protect for negative ttl * Added more documentation to the RpcClient interface * Cannot use UAttributes in RpcClient, Should be CallOptions * Missing test code * Fix the readme * Fix invokeMethod() parameter name * Fixed the wrong attribute name... * Fix isRpcMethod() and isRpcResponse() * Pull in latest core-api changes * minor comment fixes * Adding UPayloadBuilder for evaluation * Add test for build UResource using protobuf generated code. Also updated to latest core-api version * fix merge issue * Pull in changes from core-api uauthority_fix branch * Use 1.5.5 of core-api * Renaming in pom.xml and fix README * Remove unused import
- Loading branch information
Steven Hartley
authored
Jan 18, 2024
1 parent
264f042
commit 851fe5b
Showing
21 changed files
with
499 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2023 General Motors GTO LLC | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
* SPDX-FileType: SOURCE | ||
* SPDX-FileCopyrightText: 2023 General Motors GTO LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.eclipse.uprotocol.rpc; | ||
|
||
import org.eclipse.uprotocol.v1.*; | ||
|
||
/** | ||
* RpcServer is an interface called by uServices to register method listeners for incoming RPC requests | ||
* from clients. | ||
*/ | ||
public interface RpcServer { | ||
|
||
/** | ||
* Register a listener for a particular method URI to be notified when requests are sent against said method. | ||
* | ||
* <p>Note: Only one listener is allowed to be registered per method URI. | ||
* | ||
* @param method Uri for the method to register the listener for. | ||
* @param listener The listener for handling the request method. | ||
* @return Returns the status of registering the RpcListener. | ||
*/ | ||
UStatus registerRpcListener(UUri method, URpcListener listener); | ||
|
||
/** | ||
* Unregister an RPC listener for a given method Uri. Messages arriving on this topic will no longer be processed | ||
* by this listener. | ||
* @param method Resolved UUri for where the listener was registered to receive messages from. | ||
* @param listener The method to execute to process the date for the topic. | ||
* @return Returns status of registering the RpcListener. | ||
*/ | ||
UStatus unregisterRpcListener(UUri method, URpcListener listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.eclipse.uprotocol.rpc; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import org.eclipse.uprotocol.v1.*; | ||
|
||
/** | ||
* uService (servers) implement this to receive requests messages from clients. <br> | ||
* The service must implement the {@link #onReceive(UMessage, CompletableFuture)} method to handle | ||
* the request and then complete the future passed to the method that triggers the uLink library to | ||
* send (over the transport) the response. | ||
*/ | ||
public interface URpcListener { | ||
|
||
/** | ||
* Method called to handle/process events. | ||
* @param message Message received. | ||
*/ | ||
void onReceive(UMessage message, CompletableFuture<UPayload> responseFuture); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.