Monday, May 26, 2014

Testing Anypoint Studio 3.5.0 and Mule ESB 3.5.0

Today I've been playing with the new Anypoint Studio (formerly known as MuleStudio) that was released last week. Among many features I'd like to highlight a couple that I regard very useful, apart from this, Studio has gained a lot in usability and user experience.

WebService Consumer Element

This is a new feature for MuleESB 3.5.0 and it has a really nice integration with studio. Traditionally, in order to consume a SOAP web service from Mule, one would have needed to either generate a Java-based client or deal with raw SOAP XML payloads. Now, by simply specifying a WSDL, studio helps us presenting the available bindings and ports. Finally, thanks to Data sense and DataMapper (these features were present on previous versions of MuleStudio), you can easily populate the request and take advantage of the response.

This is how our flow would look like:


This approach is very lightweight and is by far easier than the previous approach with the CXF Module.

Request-Reply Element

Finally, request-reply has gained visual support, this element is particularly useful when we have to call asynchronous services but need to synchronously wait for the response. This element is not new but for long time has been something we'd need to go to the XML view to take advantage of. Now we have nice visual integration.

This is a sample flow demonstrating the use of the request-reply element:


This flow places a call into a VM queue (could be JMS as well) and waits for the response in the reply queue. This allows us to synchronize the call to the second flow within the first one but at the same time keep it's asynchronous nature for other consumers.

Scatter-Gather

This element allow us to run multiple routes but in parallel, and take advantage of the result, this is, an asynchronous counterpart for the existing 'All' router. Previously, this behavior could have only been achieved in an 'artificial' way, this is mixing request-reply, all and collection aggregator. Now it is available to use in a general form.

Here are sample flows showing the parallel processing of this component:


The invoked flow, sleeps for 2 seconds and produces a log statement before the sleep happens.


Database Access Reloaded

Previously, MuleESB had the JDBC transport, which was sort of un-natural for new MuleESB versions but at the time of it's release Mule didn't have features such as poll or watermark. Now, database access has been transformed into a shiny module that tackles access to databases in a very consistent and easy way. The following example shows how to run a query every 30 seconds and log the resulting records.


This module allows easy creation of parameterized queries (before these queries were also possible but somehow unnatural to produce), easy access to stored procedures and other interesting features.

Source Code

The following snippet is the XML source for the previous examples that demonstrates a more comprehensive view of the settings applied to the components:



Final Words

Studio and Mule 3.5.0 are very promising versions of this integration platform. It has a great deal of features that are not 'visual' but extremely important for our integration architecture, I.E. shared domains, which allows us to split our integration into multiple apps and be able to internally communicate between them.

4 comments:

  1. How to you use a Stored Procedure with a In parameter ?

    ReplyDelete
    Replies
    1. Hi Anirban,

      Please check mulesoft's documentation in order to get examples and further description on how to use the DB module.

      Delete
  2. Hi,

    You wrote "This module allows easy creation of parameterized queries (before these queries were also possible but somehow unnatural to produce), easy access to stored procedures and other interesting features." At the moment we are still using Mule 3.4, I would like to use parameterized queries to prevent SQL injection. Can you point me to somewhere the use of parameterized insert statements is explained? I can't seem to find it in the Mulesoft documentation.

    ReplyDelete
  3. Never mind, I just found out how to do this
    http://www.mulesoft.org/documentation-3.2/display/MULE2INTRO/Mule+2.2.7+Feature+Highlights

    ReplyDelete