locked
add metadata to servicebus message RRS feed

  • Question

  • Hi,

    I am pushing the POST payload body from the API management to a ServiceBus using a policy (below example which worked for me). I want to read the subscription name on the requests and tag it along on the message metadata going to the service bus. Can you please suggest an approach to do the same.

    <inbound>
    <base />
    <authentication-managed-identity resource="https://servicebus.azure.net" output-token-variable-name="msi-access-token" ignore-error="false" />
    <set-header name="Authorization" exists-action="override">
    <value>@((string)context.Variables["msi-access-token"])</value>
    </set-header>
    <set-body>
    {
    "Body": "This is the 1st message",
    "BrokerProperties":{"Label":"M3"},
    "UserProperties":{"Priority":"Medium","Customer":"ABC"}
    }
    </set-body>
    <set-backend-service base-url="https://{{serviceBusNamespace}}.servicebus.windows.net/{{queue/topic}}/messages" />
    </inbound>


    -Ujjwal

    Monday, November 18, 2019 3:30 PM

All replies