Working with data across the JVM, the web and the enterprise with all the different formats and structures is too damn hard. We’d like to introduce an easier way that will hopefully change the way that you write applications: Mule Query Language. With it you can easily:

  • Query web APIs and work with the data in the format and structure you want
  • Enrich and join data from external services with local services
  • Compose RESTful services from existing services
  • Version services and data formats
  • Merge data from different sources into a common data format
  • Transform data from your backend services to the desired frontend format
  • Sort through sets of data

The language is LINQ-inspired language and allows you to filter, join and transform data from Mule messages, from the web and other services via Cloud Connectors, from your local Spring beans, and from any other object, in very concise query statements.

Here are some examples of what you can do:

Filter objects from a Collection of user objects from a Spring bean:

from userManager.users where division = 'Engineering' and company = 'MuleSoft'

Transform an existing object into a Map/POJO. This expression creates a new Map with a name property from the firstName and lastName properties on the user object.

from users as u select new { name = u.firstName + ' ' + u.lastName }

Instant RESTful services by creating a query-service inside of Mule:

<mql:query-service name=“UsersService" address="http://localhost:9002/mulesoft-users" query="from userManager.users as u where email like 'mulesoft.com'"/>

Join data from the web with Cloud Connectors to create new objects with both local and remote data:

from userManager.users as user

  join salesforce.query('SELECT Company, MobilePhone FROM Lead WHERE Email = \'' + user.email + '\'', 1)

  as sfuser

  select new { name = user.name, email = user.email, company = sfuser[0].?Company, mobilePhone = sfuser[0].?MobilePhone }

Or you can version your SOAP/REST services, merge disparata data formats, or use MQL to query your Java objects.

For more information and examples, see the announcement or go straight to the documentation or download page.