Azure / Azure/azure-functions-java-library

@EventHubTrigger cannot deserialize HttpResponseMessage. What is best way to deserialize HttpResponseMessage?

Open
#74 3 comments 2 reactions 0 assignees View on GitHub
area:java-functions
Dominant language
Java
Stars
45
Forks
49
PR merge metrics
No merged PRs in 30d

Description

I have a function(@HttpTrigger) which writes HttpResponseMessage to email topic. I am trying to create another function(@EventHubTrigger) to read message from this topic.

````
@FunctionName("EventHubTrigger-EmailCurated")
public void run(
@EventHubTrigger(name = "httpResponseMessage", eventHubName = "email", connection = "AzureEventHubConnection") HttpResponseMessage httpResponseMessage,
final ExecutionContext context) {
logger = context.getLogger();
logger.info("EventHubTrigger-EmailCurated received a httpResponseMessage : " + httpResponseMessage);
}
````
````
Stack: java.lang.RuntimeException: Unable to invoke no-args constructor for interface com.microsoft.azure.functions.HttpResponseMessage. Registering an InstanceCreator with Gson for this type may fix this problem.
Caused by: java.lang.UnsupportedOperationException: Interface can't be instantiated! Interface name: com.microsoft.azure.functions.HttpResponseMessage
````
I understand HttpResponseMessage is an interface. Is there any implementation class available that I can cast to?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining the @EventHubTrigger parameter binding and the HttpResponseMessage interface mentioned in the report. Reproduce the Gson deserialization failure, then determine whether the supported behavior or documentation should explain how messages written from an @HttpTrigger can be consumed; done requires a clear, tested resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java
Domain
api, backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.