---
schema_version: "1"
id: be1d40e8fa6361b7a613715311540c25be8f8222ac98d419aa64fcc7fefd40ab
title: VM Connector Dynamic Routing Example
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/vm-connector/latest/vm-dynamic-routing.md
canonical_url: https://docs.mulesoft.com/vm-connector/latest/vm-dynamic-routing
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a93f0ffb4577b0a492791de5f69ae6d4711fc1ec9a027590b94fdcf075fdb04f
description: MuleSoft Documentation Site
release: "2.0"
latest: true
---
---
product: VM Connector
version: 2.0
is-latest-version: true
---

# VM Connector Dynamic Routing Example

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

You can use expressions to have a generic flow that sends messages to different queues depending on
certain conditions. For instance, you can make [the publish and listen example](https://docs.mulesoft.com/vm-connector/latest/vm-publish-listen)
more interesting by also using an expression in the `queueName` attribute.

Suppose that the JSON object that you get through the HTTP connector includes a destination object
that maps directly to the name of the queue to which you need to write. You can do the following:

```xml
<flow name="publish">
    <http:listener path="/json-here" allowedMethods="POST" config-ref="httpListener" />
    <vm:publish queueName="#[payload.destination]">
        <vm:content>#[payload.body]</vm:content>
    </vm:publish>
    <logger/>
</flow>
```
