Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Provide an example Azure Function #22

Open
AshleyJButcher opened this issue Jan 9, 2024 · 7 comments
Open

Feature: Provide an example Azure Function #22

AshleyJButcher opened this issue Jan 9, 2024 · 7 comments
Labels
type: feature New feature or request

Comments

@AshleyJButcher
Copy link

Would be useful to see an azure function

@AshleyJButcher AshleyJButcher added the type: feature New feature or request label Jan 9, 2024
@AButcherCFC
Copy link

@cdavernas

@cdavernas
Copy link
Member

Hey @AshleyJButcher!

What do you want to see? An Azure Function serving an AsyncAPI document? Or an AsyncAPI document describing an AzureFunction? Both?

Anyways, I'm sorry but I won't have time to do so any time soon, got a lot cooking on the stove. You are however more than welcome to submit a PR addressing it!

@cdavernas
Copy link
Member

@AButcherCFC @AshleyJButcher Care to clarify your expectations?

@AButcherCFC
Copy link

@cdavernas

Ideally i wanted to have my Azure Function be able to auto generate an AsyncAPI Document, in a similar manner to swagger

@cdavernas
Copy link
Member

cdavernas commented Jan 3, 2025

@AButcherCFC Could you provide a sample, dummy Azure Function that I can work on to generate the example you are asking for?

AFAIK, I don't see any reason you could not do it out of the box using the code-first, attribute-based approach

@AButcherCFC
Copy link

`using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;

namespace ServiceBusFunctionApp
{
public static class ServiceBusTriggerFunction
{
[FunctionName("ServiceBusTriggerFunction")]
public static void Run(
[ServiceBusTrigger("input-queue", Connection = "ServiceBusConnection")] string message,
[ServiceBus("output-topic", Connection = "ServiceBusConnection")] out string outputMessage,
ILogger log)
{
log.LogInformation($"Received message: {message}");

        try
        {
            // Process the incoming message (optional)
            string processedMessage = $"Processed: {message}";

            // Set the outgoing message
            outputMessage = processedMessage;
            log.LogInformation($"Message sent to output topic: {processedMessage}");
        }
        catch (Exception ex)
        {
            log.LogError($"Error processing the message: {ex.Message}");
            throw;
        }
    }
}

}
`

@AButcherCFC
Copy link

Sorry @cdavernas, I'm just looking for an example in your examples folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants