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

V3 Return style attributes #4

Open
sadgit opened this issue May 4, 2020 · 2 comments
Open

V3 Return style attributes #4

sadgit opened this issue May 4, 2020 · 2 comments

Comments

@sadgit
Copy link

sadgit commented May 4, 2020

This was an excellent aid to writing functions - things have moved on.

For ServiceBus outputs the new preferred method is to use a return type binding as per

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-output?tabs=csharp

[<FunctionName("my_V3_functiony")>]
let ``sBus In and Sbus Out`` 
   (executionContext: ExecutionContext, log: ILogger,
    [<ServiceBusTrigger("inQueue", Connection = "InQueueSetting")>] message: string)
    : [<return: ServiceBus("outTopic", ServiceBus.EntityType.Topic, Connection = "outTopicSetting")>] string =
  message 
   |> ``domain Function That Return Output Message As String``

Note - Fantomas messes up the return attribute.

@Youenn-Bouglouan
Copy link
Contributor

Youenn-Bouglouan commented May 7, 2020

@sadgit if you also want to do more complex things in the function body (for instance respond to an HTTP request), you can also use the IAsyncCollector class.
See example in the PR here #5

@sadgit
Copy link
Author

sadgit commented May 8, 2020

I have been having some issues with the Microsoft.Azure.ServiceBus 4.1.3 - which is happy with the return Attribute but didn't want to respect old style (v2) Async Collector.
This also causes complication of HTTP triggers and multiple output Queues.
Our codebase is fine - but I wanted to keep these examples current as I found them useful.

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

No branches or pull requests

2 participants