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

Invoking Service Bus function via admin endpoint and passing payload + headers #4191

Open
SeanFeldman opened this issue Nov 13, 2024 · 2 comments

Comments

@SeanFeldman
Copy link

The documentation shows how to invoke HTTP-triggered functions. It shows Azure Storage Queues for non-HTTP functions, but that scenario is straightforward because the data posted is transformed into the Storage Queue payload as-is. With ASB, custom headers (application properties) can also be passed in addition to the message payload. Is it possible to achieve passing headers + body for the message? And if 'yes', what's the correct syntax?

Original question from StackOverflow.

@zvrba
Copy link

zvrba commented Jan 13, 2025

Use ServiceBusSender and construct the message to be sent as below (just an example):

        var ret = new ServiceBusMessage(bodyData)
        {
            ContentType = ...,
            Subject = ...,
        };
        ret.ApplicationProperties["YourProperty"] = value;

Note the use of ApplicationProperties dictionary for custom "headers". Also note that only some data types are supported for the value.

@SeanFeldman
Copy link
Author

@zvrba, did you read the referenced documentation?

You can also run a non-HTTP function locally using REST by calling a special endpoint called an administrator endpoint. Use this format to call the admin endpoint and trigger a specific non-HTTP function

What you're showing is not an admin endpoint invocation, which is what this question is about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants