From 7e732a550b3cbe04823169d5bf2d75415ccd9253 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Thu, 21 Feb 2019 17:13:33 +0800 Subject: [PATCH 01/13] add java gitignore --- .gitignore | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 3c1a55b6..2d027c45 100644 --- a/.gitignore +++ b/.gitignore @@ -329,8 +329,22 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ +# Visual Studio Code .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +*/.vscode/* + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar +*.factorypath + +# Java output +*/target/* From 82e1bd7f2db3f826aaf50beeb401092820cb4ff2 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Thu, 21 Feb 2019 17:17:37 +0800 Subject: [PATCH 02/13] exclude Java IDEs --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 2d027c45..bab36efe 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,11 @@ ASALocalRun/ # Java output */target/* + +# Java IDE +.idea/ +*.iml +.classpath +.project +.settings/ +.checkstyle From 604e33546c196e06d92a90979ac74520d286ddf1 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 13:27:16 +0800 Subject: [PATCH 03/13] add java library --- .gitignore | 4 +- .travis.yml | 1 + binding-library/java/README.md | 14 +++ binding-library/java/pom.xml | 117 ++++++++++++++++++ .../signalr/SignalRConnectionInfo.java | 25 ++++ .../functions/signalr/SignalRGroupAction.java | 30 +++++ .../functions/signalr/SignalRMessage.java | 38 ++++++ .../SignalRConnectionInfoInput.java | 47 +++++++ .../signalr/annotation/SignalROutput.java | 33 +++++ 9 files changed, 307 insertions(+), 2 deletions(-) create mode 100644 binding-library/java/README.md create mode 100644 binding-library/java/pom.xml create mode 100644 binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRConnectionInfo.java create mode 100644 binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRGroupAction.java create mode 100644 binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRMessage.java create mode 100644 binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java create mode 100644 binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java diff --git a/.gitignore b/.gitignore index bab36efe..97ad143c 100644 --- a/.gitignore +++ b/.gitignore @@ -335,7 +335,7 @@ ASALocalRun/ !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json -*/.vscode/* +**/.vscode/* # Package Files # *.jar @@ -347,7 +347,7 @@ ASALocalRun/ *.factorypath # Java output -*/target/* +**/target/* # Java IDE .idea/ diff --git a/.travis.yml b/.travis.yml index 2ca5af98..848d5148 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,4 @@ addons: - libunwind8 script: - "./build.sh --ci /p:BuildNumber=$((10000+TRAVIS_BUILD_NUMBER))" +- mvn clean package -f binding-library\java\pom.xml diff --git a/binding-library/java/README.md b/binding-library/java/README.md new file mode 100644 index 00000000..72f1506a --- /dev/null +++ b/binding-library/java/README.md @@ -0,0 +1,14 @@ + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/binding-library/java/pom.xml b/binding-library/java/pom.xml new file mode 100644 index 00000000..925e6d16 --- /dev/null +++ b/binding-library/java/pom.xml @@ -0,0 +1,117 @@ + + + 4.0.0 + + com.microsoft.azure.functions + azure-functions-java-library-signalr + 1.0-SNAPSHOT + jar + + Microsoft Azure Functions Java SignalR Types + This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime for SignalR Service. + https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service + + Microsoft Azure + https://azure.microsoft.com + + + + UTF-8 + 1.3.0-SNAPSHOT + + + + + MIT License + https://opensource.org/licenses/MIT + repo + + + + + + anthonychu + Anthony Chu + Anthony.Chu@microsoft.com + + + JialinXin + Jialin Xin + jixin@microsoft.com + + + + + + maven.snapshots + Maven Central Snapshot Repository + https://oss.sonatype.org/content/repositories/snapshots/ + + false + + + true + + + + + + + com.microsoft.azure.functions + azure-functions-java-library + ${azure.functions.java.library.version} + + + + + + + maven-compiler-plugin + + + org.apache.maven.plugins + maven-source-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce-maven + + enforce + + + + + 3.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + ${project.build.directory} + + + testing-project-jar + ${project.artifactId}-${project.version}-tests.jar + + + + + + + + \ No newline at end of file diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRConnectionInfo.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRConnectionInfo.java new file mode 100644 index 00000000..14e77fe2 --- /dev/null +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRConnectionInfo.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +package com.microsoft.azure.functions.signalr; + +/** + *

+ * SignalR connection information (used with SignalRConnectionInfo input binding) + *

+ * + * @since 1.0.0 + */ +public class SignalRConnectionInfo { + /** + * SignalR Sevice endpoint + */ + public String url; + + /** + * Access token to use to connect to SignalR Service endpoint + */ + public String accessToken; +} \ No newline at end of file diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRGroupAction.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRGroupAction.java new file mode 100644 index 00000000..4cffa941 --- /dev/null +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRGroupAction.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +package com.microsoft.azure.functions.signalr; + +/** + *

+ * SignalR group action (used with SignalR output binding) + *

+ * + * @since 1.0.0 + */ +public class SignalRGroupAction { + /** + * User to add to or remove from group + */ + public String userId = ""; + + /** + * Group to add user to or remove user from + */ + public String groupName = ""; + + /** + * Action to take ("add" or "remove") + */ + public String action = ""; +} \ No newline at end of file diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRMessage.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRMessage.java new file mode 100644 index 00000000..c55422fd --- /dev/null +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/SignalRMessage.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +package com.microsoft.azure.functions.signalr; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * SignalR Message to use with SignalR output binding + *

+ * + * @since 1.0.0 + */ +public class SignalRMessage { + /** + * User to send the message to + */ + public String userId = ""; + + /** + * Group to send the message to + */ + public String groupName = ""; + + /** + * Target method to invoke on clients + */ + public String target; + + /** + * Arguments to pass to target method + */ + public List arguments = new ArrayList(); +} \ No newline at end of file diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java new file mode 100644 index 00000000..a4ba9448 --- /dev/null +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +package com.microsoft.azure.functions.signalr.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.ElementType; + +import com.microsoft.azure.functions.annotation.CustomBinding; + +/** + *

Place this on a parameter to obtain a SignalRConnectionInfo object. + * The parameter type can be one of the following:

+ * + *
    + *
  • SignalRConnectionInfo type
  • + *
+ */ +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +@CustomBinding(direction = "in", name = "connectionInfo", type = "SignalRConnectionInfo") +public @interface SignalRConnectionInfoInput { + + /** + * The variable name used in function.json. + * @return The variable name used in function.json. + */ + String name() default ""; + + /** + * Defines the name of the hub in Azure SignalR Service to which to connect. + * @return The hub name. + */ + String hubName(); + + /** + * Defines the user ID to associate with the connection. Typically uses a + * binding expression such as {x-ms-client-principal-name} (the principal name + * from App Service Authentication). + * @return The user ID. + */ + String userId() default ""; +} diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java new file mode 100644 index 00000000..64ca3b75 --- /dev/null +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +package com.microsoft.azure.functions.signalr.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.ElementType; + +import com.microsoft.azure.functions.annotation.CustomBinding; + +/** + *

Output type to Azure SignalR Service

+ */ +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@CustomBinding(direction = "out", name = "signalRMessage", type = "SignalR") +public @interface SignalROutput { + /** + * The variable name used in function.json. + * @return The variable name used in function.json. + */ + String name() default ""; + + /** + * Defines the name of the hub in Azure SignalR Service to which to connect. + * @return The hub name. + */ + String hubName(); +} From 8b8c7209ecd5c791b52f1ed4a2de70573783fae1 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 13:44:37 +0800 Subject: [PATCH 04/13] install mvn in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 848d5148..14177e01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,5 @@ addons: - libunwind8 script: - "./build.sh --ci /p:BuildNumber=$((10000+TRAVIS_BUILD_NUMBER))" +- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V || travis_terminate 1 - mvn clean package -f binding-library\java\pom.xml From 71e80d365b362763451edc15288648278f4c5b51 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 14:05:22 +0800 Subject: [PATCH 05/13] update maven install --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 14177e01..be0376ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,12 @@ dotnet: 2.1.301 os: - linux - osx +before_install: + - sudo apt-get install maven addons: apt: packages: - libunwind8 script: - "./build.sh --ci /p:BuildNumber=$((10000+TRAVIS_BUILD_NUMBER))" -- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V || travis_terminate 1 - mvn clean package -f binding-library\java\pom.xml From 6bdf0bfe8943866be21f71700a734cf720f30cc9 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 14:12:59 +0800 Subject: [PATCH 06/13] fix paths --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index be0376ee..7de61945 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,12 +8,11 @@ dotnet: 2.1.301 os: - linux - osx -before_install: - - sudo apt-get install maven addons: apt: packages: - libunwind8 + - maven script: - "./build.sh --ci /p:BuildNumber=$((10000+TRAVIS_BUILD_NUMBER))" -- mvn clean package -f binding-library\java\pom.xml +- mvn clean package -f ./binding-library/java/pom.xml From 2074e823482e55e98c70f053949c9dc1472aaf30 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 14:30:16 +0800 Subject: [PATCH 07/13] remove unused plugins and version assign --- binding-library/java/pom.xml | 43 +++++------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/binding-library/java/pom.xml b/binding-library/java/pom.xml index 925e6d16..5b5e1990 100644 --- a/binding-library/java/pom.xml +++ b/binding-library/java/pom.xml @@ -68,49 +68,16 @@ - maven-compiler-plugin + maven-compiler-plugin + + 1.6 + 1.6 + org.apache.maven.plugins maven-source-plugin - - org.apache.maven.plugins - maven-javadoc-plugin - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0-M2 - - - enforce-maven - - enforce - - - - - 3.2.0 - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - ${project.build.directory} - - - testing-project-jar - ${project.artifactId}-${project.version}-tests.jar - - - - From e74c3c95c5784c19fc56ce1a3b5ee0c83505b984 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 14:53:52 +0800 Subject: [PATCH 08/13] uniform spaces in pom --- binding-library/java/pom.xml | 131 +++++++++++++++++------------------ 1 file changed, 65 insertions(+), 66 deletions(-) diff --git a/binding-library/java/pom.xml b/binding-library/java/pom.xml index 5b5e1990..8a0dd735 100644 --- a/binding-library/java/pom.xml +++ b/binding-library/java/pom.xml @@ -1,37 +1,37 @@ - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.microsoft.azure.functions - azure-functions-java-library-signalr - 1.0-SNAPSHOT - jar + com.microsoft.azure.functions + azure-functions-java-library-signalr + 1.0-SNAPSHOT + jar - Microsoft Azure Functions Java SignalR Types - This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime for SignalR Service. - https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service - - Microsoft Azure - https://azure.microsoft.com - + Microsoft Azure Functions Java SignalR Types + This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime for SignalR Service. + https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service + + Microsoft Azure + https://azure.microsoft.com + - - UTF-8 - 1.3.0-SNAPSHOT - - - - - MIT License - https://opensource.org/licenses/MIT - repo - - - - - + + UTF-8 + 1.3.0-SNAPSHOT + + + + + MIT License + https://opensource.org/licenses/MIT + repo + + + + + anthonychu Anthony Chu Anthony.Chu@microsoft.com @@ -42,43 +42,42 @@ jixin@microsoft.com - - - - maven.snapshots - Maven Central Snapshot Repository - https://oss.sonatype.org/content/repositories/snapshots/ - - false - - - true - - - - - - - com.microsoft.azure.functions - azure-functions-java-library - ${azure.functions.java.library.version} - - + + + + maven.snapshots + Maven Central Snapshot Repository + https://oss.sonatype.org/content/repositories/snapshots/ + + false + + + true + + + - - - - maven-compiler-plugin - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-source-plugin - - - + + + com.microsoft.azure.functions + azure-functions-java-library + ${azure.functions.java.library.version} + + + + + + maven-compiler-plugin + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-source-plugin + + + \ No newline at end of file From ccd0b684bc00c7be7741e130da0bdf6b13fa99b0 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 15:16:32 +0800 Subject: [PATCH 09/13] try multiple travis --- .travis.yml | 1 - binding-library/java/.travis.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 binding-library/java/.travis.yml diff --git a/.travis.yml b/.travis.yml index 7de61945..51c2e861 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,4 +15,3 @@ addons: - maven script: - "./build.sh --ci /p:BuildNumber=$((10000+TRAVIS_BUILD_NUMBER))" -- mvn clean package -f ./binding-library/java/pom.xml diff --git a/binding-library/java/.travis.yml b/binding-library/java/.travis.yml new file mode 100644 index 00000000..9566d399 --- /dev/null +++ b/binding-library/java/.travis.yml @@ -0,0 +1,15 @@ +language: java +branches: + only: + - dev +jdk: + - oraclejdk8 +os: +- linux +- osx +addons: + apt: + packages: + - maven +script: +- mvn clean package From 5baabdf80b040f3f5514d7c5b827ab912e934400 Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 16:05:53 +0800 Subject: [PATCH 10/13] revert sub travis config and update --- .travis.yml | 1 + binding-library/java/.travis.yml | 15 ------- binding-library/java/README.md | 40 +++++++++++++++++++ .../SignalRConnectionInfoInput.java | 28 ++++++++----- .../signalr/annotation/SignalROutput.java | 14 +++++-- 5 files changed, 68 insertions(+), 30 deletions(-) delete mode 100644 binding-library/java/.travis.yml diff --git a/.travis.yml b/.travis.yml index 51c2e861..7de61945 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,3 +15,4 @@ addons: - maven script: - "./build.sh --ci /p:BuildNumber=$((10000+TRAVIS_BUILD_NUMBER))" +- mvn clean package -f ./binding-library/java/pom.xml diff --git a/binding-library/java/.travis.yml b/binding-library/java/.travis.yml deleted file mode 100644 index 9566d399..00000000 --- a/binding-library/java/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: java -branches: - only: - - dev -jdk: - - oraclejdk8 -os: -- linux -- osx -addons: - apt: - packages: - - maven -script: -- mvn clean package diff --git a/binding-library/java/README.md b/binding-library/java/README.md index 72f1506a..b7e670cf 100644 --- a/binding-library/java/README.md +++ b/binding-library/java/README.md @@ -1,3 +1,43 @@ +# SignalR Service Library for Azure Java Functions +This repo contains SignalR serivce library for building Azure Java Functions. Visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details. + +## azure-functions-maven plugin +[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable) + +## Prerequisites + +* Java 8 +* [Azure Function Core Tools](https://github.com/Azure/azure-functions-core-tools) (V2) +* Maven 3.0 or above +* [Azure Function Maven Plugin](https://github.com/Microsoft/azure-maven-plugins/) (1.3.0-SNAPSHOT or above) + +### Sample + +Here is an example of a HttpTrigger Azure function using SignalR service in Java: + +```java +package com.example; + +import com.microsoft.azure.functions.*; +import com.microsoft.azure.functions.annotation.*; +import com.microsoft.azure.functions.signalr.*; +import com.microsoft.azure.functions.signalr.annotation.*; + +public class Functions { + @FunctionName("negotiate") + public SignalRConnectionInfo negotiate( + @HttpTrigger( + name = "req", + methods = { HttpMethod.POST, HttpMethod.GET }, + authLevel = AuthorizationLevel.ANONYMOUS) + HttpRequestMessage> req, + @SignalRConnectionInfoInput(name = "connectionInfo", hubName = "simplechat") SignalRConnectionInfo connectionInfo) { + + return connectionInfo; + } +}| +``` +Take a look at [SimpleChatRoom](https://github.com/Azure/azure-functions-signalrservice-extension/tree/dev/samples/simple-chat/java) for other using cases. # Contributing diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java index a4ba9448..4dbcb829 100644 --- a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java @@ -25,19 +25,25 @@ @CustomBinding(direction = "in", name = "connectionInfo", type = "SignalRConnectionInfo") public @interface SignalRConnectionInfoInput { - /** - * The variable name used in function.json. - * @return The variable name used in function.json. - */ - String name() default ""; + /** + * The variable name used in function.json. + * @return The variable name used in function.json. + */ + String name() default ""; - /** - * Defines the name of the hub in Azure SignalR Service to which to connect. - * @return The hub name. - */ - String hubName(); + /** + * Defines the app setting name that contains the Azure SignalR Service connection string. + * @return The app setting name of the connection string. + */ + String connectionStringSetting() default ""; - /** + /** + * Defines the name of the hub in Azure SignalR Service to which to connect. + * @return The hub name. + */ + String hubName(); + + /** * Defines the user ID to associate with the connection. Typically uses a * binding expression such as {x-ms-client-principal-name} (the principal name * from App Service Authentication). diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java index 64ca3b75..07d65a83 100644 --- a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java @@ -19,15 +19,21 @@ @Retention(RetentionPolicy.RUNTIME) @CustomBinding(direction = "out", name = "signalRMessage", type = "SignalR") public @interface SignalROutput { - /** + /** * The variable name used in function.json. * @return The variable name used in function.json. */ - String name() default ""; + String name() default ""; - /** + /** + * Defines the app setting name that contains the Azure SignalR Service connection string. + * @return The app setting name of the connection string. + */ + String connectionStringSetting() default ""; + + /** * Defines the name of the hub in Azure SignalR Service to which to connect. * @return The hub name. */ - String hubName(); + String hubName(); } From 11a80a6f559a8a34ce224862a10d21bce439852d Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 16:09:20 +0800 Subject: [PATCH 11/13] remove dup content in README --- binding-library/java/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/binding-library/java/README.md b/binding-library/java/README.md index b7e670cf..2a94fc3a 100644 --- a/binding-library/java/README.md +++ b/binding-library/java/README.md @@ -1,9 +1,6 @@ # SignalR Service Library for Azure Java Functions This repo contains SignalR serivce library for building Azure Java Functions. Visit the [complete documentation of Azure Functions - Java Developer Guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-java) for more details. -## azure-functions-maven plugin -[How to use azure-functions-maven plugin to create, update, deploy and test azure java functions](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-functions-maven-plugin/readme?view=azure-java-stable) - ## Prerequisites * Java 8 From c39778e5a4e938ae1917e12c314968241991cbdc Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Fri, 22 Feb 2019 16:57:45 +0800 Subject: [PATCH 12/13] make name required. --- .../signalr/annotation/SignalRConnectionInfoInput.java | 4 ++-- .../azure/functions/signalr/annotation/SignalROutput.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java index 4dbcb829..55f33713 100644 --- a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalRConnectionInfoInput.java @@ -22,14 +22,14 @@ */ @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) -@CustomBinding(direction = "in", name = "connectionInfo", type = "SignalRConnectionInfo") +@CustomBinding(direction = "in", name = "", type = "SignalRConnectionInfo") public @interface SignalRConnectionInfoInput { /** * The variable name used in function.json. * @return The variable name used in function.json. */ - String name() default ""; + String name(); /** * Defines the app setting name that contains the Azure SignalR Service connection string. diff --git a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java index 07d65a83..ab29fb51 100644 --- a/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java +++ b/binding-library/java/src/main/java/com/microsoft/azure/functions/signalr/annotation/SignalROutput.java @@ -17,13 +17,13 @@ */ @Target({ ElementType.PARAMETER, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) -@CustomBinding(direction = "out", name = "signalRMessage", type = "SignalR") +@CustomBinding(direction = "out", name = "", type = "SignalR") public @interface SignalROutput { /** * The variable name used in function.json. * @return The variable name used in function.json. */ - String name() default ""; + String name(); /** * Defines the app setting name that contains the Azure SignalR Service connection string. From 2f8cde6b4c6c9ab62b8d15bf13dce44ad0c22a8a Mon Sep 17 00:00:00 2001 From: Jialin Xin Date: Tue, 26 Feb 2019 10:52:04 +0800 Subject: [PATCH 13/13] resolve comments. --- binding-library/java/README.md | 2 +- binding-library/java/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/binding-library/java/README.md b/binding-library/java/README.md index 2a94fc3a..4fee5feb 100644 --- a/binding-library/java/README.md +++ b/binding-library/java/README.md @@ -38,7 +38,7 @@ Take a look at [SimpleChatRoom](https://github.com/Azure/azure-functions-signalr # Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. diff --git a/binding-library/java/pom.xml b/binding-library/java/pom.xml index 8a0dd735..639bcda5 100644 --- a/binding-library/java/pom.xml +++ b/binding-library/java/pom.xml @@ -6,7 +6,7 @@ com.microsoft.azure.functions azure-functions-java-library-signalr - 1.0-SNAPSHOT + 1.0.0-SNAPSHOT jar Microsoft Azure Functions Java SignalR Types