Support new templates with functions extension bundle v4 (#199)

* Update version, prepare for next release

* Support create DurableFunctions with -Dtrigger in functions maven archetype

* Add required dependencies for rabbitmq/durable functions in archetype
This commit is contained in:
Hanxiao Liu 2022-11-23 09:50:42 +08:00 коммит произвёл GitHub
Родитель caf3fb4312
Коммит 4402a7faa4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 40 добавлений и 8 удалений

Просмотреть файл

@ -53,9 +53,9 @@ Parameter Name | Default Value | Description
`appRegion` | `westus` | The region of your Azure Functions, which will be used when creating the new Azure Functions.
`appServicePlanName` | `java-functions-app-service-plan` | The the app service plan of your Azure Functions, which will be used when creating the new Azure Functions.
`resourceGroup` | `java-functions-group` | The the resource group of your Azure Functions, which will be used when creating the new Azure Functions.
`javaVersion` | `8` | The the function host java version as well as the project compile level, supported values are `8`, `11` or `17`
`docker` | `false` | The whether to enable docker support in your function project
`trigger` | `HttpTrigger` | Specify the trigger type of Azure Function, supported values are `BlobTrigger`,`QueueTrigger`,`TimerTrigger`,`EventGridTrigger`,`EventHubTrigger`,`CosmosDBTrigger`,`ServiceBusQueueTrigger`,`ServiceBusTopicTrigger` and `HttpTrigger`
`javaVersion` | `8` | The the function host java version as well as the project compile level, supported values are `8`, `11` or `17`.
`docker` | `false` | The whether to enable docker support in your function project.
`trigger` | `HttpTrigger` | Specify the trigger type of Azure Function, supported values are `HttpTrigger`, `BlobTrigger`, `QueueTrigger`, `TimerTrigger`, `EventGridTrigger`, `EventHubTrigger`, `CosmosDBTrigger`, `ServiceBusQueueTrigger`, `ServiceBusTopicTrigger` and `DurableFunctions`.
## System Requirements

Просмотреть файл

@ -6,7 +6,7 @@
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-archetype</artifactId>
<version>1.50</version>
<version>1.51-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Archetype for Azure Functions</name>

Просмотреть файл

@ -30,6 +30,7 @@ def templateMap = [
"ServiceBusTopicTrigger": "-Dfunctions.template=ServiceBusTopicTrigger -Dconnection=\"<connection>\" -DtopicName=mysbtopic -DsubscriptionName=mysubscription",
"RabbitMQTrigger" : "-Dfunctions.template=RabbitMQTrigger -DconnectionStringSetting=\"<connection>\" -DqueueName=myqueue",
"KafkaTrigger" : "-Dfunctions.template=KafkaTrigger -Dname=kafkaTrigger -Dtopic=topic -DbrokerList=BrokerList -DconsumerGroup=\$Default -DauthenticationMode=PLAIN -Dprotocol=SASLSSL",
"DurableFunctions" : "-Dfunctions.template=DurableFunctionsOrchestrator"
];
def triggerParameter = templateMap.keySet().stream()
.filter({ key -> key.equalsIgnoreCase(trigger) || key.substring(0, key.lastIndexOf("Trigger")).equalsIgnoreCase(trigger) }).findFirst()

Просмотреть файл

@ -1,7 +1,19 @@
{
"version": "2.0",
#if(${trigger.toLowerCase()}=="durablefunctions")
"extensions": {
"durableTask": {
"hubName": "JavaTestHub"
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
#else
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
#end
}

Просмотреть файл

@ -16,12 +16,18 @@
#else
<java.version>${javaVersion}</java.version>
#end
<azure.functions.maven.plugin.version>1.21.0</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>2.0.1</azure.functions.java.library.version>
<azure.functions.maven.plugin.version>1.22.0-SNAPSHOT</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>2.2.0</azure.functions.java.library.version>
#if(${appName}=="$(artifactId)-$(timestamp)")
<functionAppName>${artifactId.toLowerCase()}-${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))}</functionAppName>
#else
<functionAppName>${appName}</functionAppName>
#end
#if(${trigger.toLowerCase()}=="rabbitmq" || ${trigger.toLowerCase()}=="rabbitmqtrigger")
<azure.functions.java.library.rabbitmq.version>2.0.3</azure.functions.java.library.rabbitmq.version>
#end
#if(${trigger.toLowerCase()}=="durablefunctions")
<durabletask.azure.functions.version>1.0.0-beta.1</durabletask.azure.functions.version>
#end
</properties>
@ -31,7 +37,20 @@
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
#if(${trigger.toLowerCase()}=="rabbitmq" || ${trigger.toLowerCase()}=="rabbitmqtrigger")
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library-rabbitmq</artifactId>
<version>${azure.functions.java.library.rabbitmq.version}</version>
</dependency>
#end
#if(${trigger.toLowerCase()}=="durablefunctions")
<dependency>
<groupId>com.microsoft</groupId>
<artifactId>durabletask-azure-functions</artifactId>
<version>${durabletask.azure.functions.version}</version>
</dependency>
#end
<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>

Просмотреть файл

@ -6,7 +6,7 @@
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-archetypes</artifactId>
<version>1.51-SNAPSHOT</version>
<version>1.52-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Maven Archetypes for Azure</name>
<description>Maven Archetypes for Microsoft Azure services</description>