Skip to content

Unable to set custom properties on a ServiceBus message when using push-outputbinding #309

Open
@invisibleaxm

Description

@invisibleaxm

When working with Azure Functions V2 (Powershell) ServiceBus output binding we are not able to add any user attributes to the servicebus message since the push-outputbinding cmdlet takes the object passed in "value" as the message body (it will serialize the object and submit that as the message text/body). ideally one could craft a Service Bus message of type Microsoft.Azure.ServiceBus.Message and use this object as the input for the push-outputbinding which will then :

  1. Use the $message.body value as the contents of the serviceBus message,
  2. Allow us to set any other $message attributes we need and honor them. For example the custom attribute is of upmost importance:
Import-Module .\modules\Microsoft.Azure.ServiceBus.dll
$Message = New-Object Microsoft.Azure.ServiceBus.Message
$Message.UserProperties.Add("name", "alex")
 # Should be able to send the message object out also and not just a string
Push-OutputBinding -Name demooutputSbMsg -Value $Message

Instead, when you call push-outputbinding, the whole $message object is processed as the actual body of the message, making it impossible to set custom attributes

see example:
image

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions