Azure / Azure/azure-functions-java-worker

Query about the viability of creating an Azure Function using a dynamic JVM language

Ouverte
#359 0 commentaires 0 réactions 1 personne assignée Réclamée par @kamperiadis Voir sur GitHub
area:java-functions Enhancement New Feature reviewed
Langage dominant
Java
Étoiles
103
Forks
74
Merge moyen
4 j 8 h
PR mergées (30 j)
2

Description

I've been trying to setup an Azure Function using a dynamic JVM language (Clojure). With Clojure it is possible to put type hints on function arguments which are then present in the bytecode but it is not possible, as far as I understand, to add the type of a generic (i.e. I can define an argument to be a List but cannot define it to be a List\).

The documentation (https://github.com/Azure/azure-functions-java-library) seems to suggest that an Azure function can be created without type annotations, using function.json instead. However when I try to do this locally I get an error,

```
Executed 'Functions.PnlFunction' (Failed, Id=725a837b-f380-4eb0-9594-d632efe7efb8)
System.Private.CoreLib: Exception while executing function: Functions.PnlFunction. System.Private.CoreLib: Result: Failure
Exception: ClassCastException: com.microsoft.azure.functions.worker.binding.ExecutionContextDataSource cannot be cast to java.lang.String
Stack: java.lang.ClassCastException: com.microsoft.azure.functions.worker.binding.ExecutionContextDataSource cannot be cast to java.lang.String
at com.microsoft.azure.functions.worker.binding.DataOperations.apply(DataOperations.java:99)
at com.microsoft.azure.functions.worker.binding.DataSource.computeByType(DataSource.java:56)
at com.microsoft.azure.functions.worker.binding.BindingDataStore.getDataByType(BindingDataStore.java:63)
at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:65)
at com.microsoft.azure.functions.worker.broker.ParameterResolver.resolve(ParameterResolver.java:42)
at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:52)
at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:53)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:33)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:92)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
```

where it looks like the Azure lib is trying to find some type information and cannot.

I was hoping that the "dataType" attribute in the bindings section of function.json could be used instead of reflecting over the code so that dynamic JVM languages can be used more easily to create Azure functions. Does anyone know if it's possible?

Unfortunately I've not stuck to template used, as the query is more general, and is around whether it's possible to avoid reflection over my code and instead use the function.json file.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.