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

Custom message converter for Azure Functions ServiceBusTrigger #101

Closed
SeanFeldman opened this issue Mar 29, 2019 · 5 comments
Closed

Custom message converter for Azure Functions ServiceBusTrigger #101

SeanFeldman opened this issue Mar 29, 2019 · 5 comments

Comments

@SeanFeldman
Copy link
Owner

Original comment by @jstclair:

Great timing! I've done something similar, but rather than write extension methods off message, I'd just copied some of the underlying implementation into our (receiving) functions.

Sean, now that Azure Functions supports user-extensible triggers, how would feel about taking/creating a sub-project to extend the existing ServiceBus(x)Trigger with the attachments plugin support? Here's an example on extending the existing Cosmos trigger to support POCOs

@SeanFeldman
Copy link
Owner Author

@jstclair that sounds like a good idea if someone wants to use it with Functions 2.x.
I've went through some of the official documentation to get an idea what it would look like.

Converters can be used for both BindToInput and BindToCollector.

Already existing converters are:

The trigger supports the following parameter types

  • Message
  • string
  • byte[]
  • A custom type - If the message contains JSON, Azure Functions tries to deserialize the JSON data.

The output binding supports the following types

  • IAsyncCollector<T> paramName/ out T paramName - T can be any JSON-serializable type. If the parameter value is null when the function exits, Functions creates the message with a null object.
  • IAsyncCollector<string>/out string - If the parameter value is null when the function exits, Functions does not create a message.
  • IAsyncCollector<byte[]>/out byte[] - If the parameter value is null when the function exits, Functions does not create a message.
  • IAsyncCollector<Message>/out Message - If the parameter value is null when the function exits, Functions does not create a message.
  • IAsyncCollector<T>/ICollector<T> - For creating multiple messages. A message is created when you call the Add method.

I'm not entirely sure yet how it will work, but we can start a PR to get the ball rolling. Would you like to help?

@jstclair
Copy link

Sure. I'll have some time this weekend. Just to be clear, since you are mentioning the binding - the idea would be to use the Message extension methods from the previous PR in the converter implementation(s)?

@SeanFeldman
Copy link
Owner Author

SeanFeldman commented Mar 29, 2019

Haven't looked into details, but I'd think so if we get a Message in/out. Would be interesting to see how custom configuration would be specified with Functions framework.

@SeanFeldman
Copy link
Owner Author

@jstclair have you had a chance to look into this?

@SeanFeldman
Copy link
Owner Author

@jstclair I'm going to close the issue as there seems to be no traction on it. In case you do have an update, let me know and I'll re-open it. Thank you.

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