22 May / 2013
RabbitMQ Example: Direct Exchange and Fanout Routing
I will use Mule Order Processing Example as a starting point to demonstrate RabbitMQ and AMQP with Mule. The objective for this example is to show:
- A simple queue by replacing the “inhouseOrder” JMS queue with an AMQP queue (Direct Exchange Routing)
- Sending an order to a Fanout exchange for processing in fulfillment and accounting queues (Fanout Routing)
20 May / 2013
Synchronizing Email Contacts with Salesforce using Mule
Overview
SalesForce has become a popular platform for both the Startups and Big Enterprise. People are solving interesting challenges on it every day. In this blog post, we’ll take a look at a way to mash up two popular services. Both Gmail and SalesForce have popular, usable APIs but what it’s still a significant effort to integrate the two of them yourself. Thankfully, Mule offers some very helpful abstractions which makes this task easy!
The Scenario
In our example, we have little Timmy who is the newest Lemonade entrepreneur in his neighborhood. Timmy needs an advantage over his competitor, Suzy who sets up just two blocks over. Timmy is a forward thinking, young chap who decides to leverage technology to get him ahead:
- A mobile device with the Square mobile payment application (who doesn’t like spending $0.50 on their card?)
- A Gmail account where he gets BCC’d the receipts emailed to the customers
- A SalesForce.com account to organize his contacts and start marketing campaigns
Timmy has everything setup. Now he’d like to keep his SalesForce.com contacts up to date based upon the email information he receives from the BCC’d receipt. This will allow him to let his customer’s know when and where he’ll be setting up next. Timmy’s going to be the next big thing!
Stepping Back for a Second
Timmy doesn’t have a large budget. He determines that there is a lot to be done and very little in his piggy bank. Here are the basic requirements:
- Poll the Gmail account periodically
- Only parse new emails
- Ignore any emails which aren’t receipts (he doesn’t want his Grandmother in SalesForce)
- Parse the contact information on the To: address field from the email
- First Name
- Last Name
- Add or update their contact information in his SalesForce.com account
- Set the Lead Source to ‘Lemonade Customer’ so he can stay organized
- Store the email text in the description so that he can remember what they ordered last
It’s not looking so good for Timmy. Even with these well known APIs and a little programming skills, he figures this is going to be challenging at best.
Mule Saves the Day
With relatively little code and effort, we’re going to show you how Timmy can accomplish this and not even have to crack open his piggy bank. In our example, we’ll use the following components:
- IMAPS connector to watch his email account
- An Expression filter to match only the subjects he’s interested in capturing
- A custom transformer to convert the email into an object for SalesForce
- The SalesForce connector to perform an Upsert
The Gory Details
There are a few things you’ll need to do for your SalesForce.com account to synchronize. There’s also the settings and custom transformer which haven’t been included for the sake of brevity. If you’re interested, the entire project and documentation are available on our Cookbook Site on Github.
09 May / 2013
Mocking HTTP Endpoints in Mule Functional Tests
Why do we want to test?
Just as with any project, automation of testing with Mule flows is a critical process in the road to success. It’s easy to manually test a few flows from release to release but when you enter the world of 10, 20, 50+ flows, it’s going to slow down your development process and will be prone to error. Using the Mule FunctionalTestCase to create your own JUnit tests will keep you on the road to success!
Read More
08 May / 2013
WSDL first service with CXF in Mule ESB 3.4
WSDL first service is the second approach for creating a JAX-WS service with CXF in Mule. I have explained the first approach in my earlier blog (JAX-WS Service with CXF in Mule 3.4)
In this approach we start with a WSDL(Web Services Description Language) contract and generate Java objects to implement the service. This approach is preferred for new development as we define the services in the WSDL and then generate the code to implement them. This approach also makes sure that service is an abstract entity that is implementation neutral. In this approach one spends more time in creating the interface required by the service before starting the implementation.
First step in this approach is to create a WSDL with all the operations needed to be exposed by the service. Lets create a WSDL with two operations sayHello and serviceOperation as below.
Now we need to generate the service, request & response objects from the WSDL. CXF includes a maven plugin to generate java code from the WSDL. Add the plugin to your pom.xml and specify the wsdl location, sourceRoot & the goal like below.
Run the maven command “mvn generate-sources” from the project. This will generate the service, request & response objects.
Now we need to implement the service (CXFWebservice) and code the logic for each operation in the service like below.
/**
* Class to implement CXFWebservice interface
*/
package com.confluex.service.impl;
import java.util.List;
import javax.jws.WebService;
import com.confluex.service.CXFWebservice;
/**
* @author Brigilin Stanley
*
*/
@WebService( endpointInterface = "com.confluex.service.CXFWebservice", serviceName="CXFWebservice", wsdlLocation="cxfwebservice.wsdl")
public class CXFWebserviceImpl implements CXFWebservice
{
/* (non-Javadoc)
* @see com.confluex.service.CXFWebservice#sayHello(java.lang.String)
*/
@Override
public String sayHello(String strUser)
{
return "Welcome to Confluex!!! 'The Mule ESB experts.' " + strUser;
}
/* (non-Javadoc)
* @see com.confluex.service.CXFWebservice#serviceOperation(java.util.List)
*/
@Override
public String serviceOperation(List list)
{
// TODO Auto-generated method stub
return null;
}
}
Final step is to create a mule flow to use the WSDL and implementation class as a JAX-WS service with CXF. In the mule flow specify a HTTP Inbound Endpoint with the exchange-pattern as request-response. Add cxf:jaxws-service within the inbound endpoint and specify the service generated above from the WSDL above as the service class.
Add a Component after the HTTP Inbound Endpoint and specify the implementation class created above.
Build and run the application as a mule application within MuleStudio
Open the following url ( http://localhost:8081/cxfwsdlwebservice?wsdl ) in a browser and we can see the WSDL generated by CXF framework.
01 May / 2013
JAX-WS Service with CXF in Mule 3.4
CXF is a services framework which helps to build and develop web services using programming APIs like JAX-WS & JAX-RS. CXF supports a variety of web service standards including SOAP, WSDL, WS-Addressing, WS-Security, WS-Policy. For REST services CXF supports JAX-RS.
In JAX-WS, a web service operation invocation is represented by
Read More
05 Apr / 2013
Coming to a Mule Summit near you!
The 2013 Mule Summits are almost upon us…
…and Confluex is excited to be a part of it. So excited, we decided to sponsor lunch! So come eat our lunch, and listen to some great speakers talk about integration and Mule ESB, and meet our integration experts!
Here’s the itinerary:
- Tuesday, April 9: Los Angeles
- Thursday, April 11: San Francisco
- Tuesday, April 30: New York
- Thursday, May 2: Dallas
- Friday, May 3: Chicago
also, we are giving away an iPad mini.
Open Source Outer Space Integration
Confluex is proud to announce the public availability of our Mule Cloud Connector for the International Space Station.
Over the course of my career, I have worked with many companies that were using the oldest, legacy-est of the legacy integration concepts – batch file transfers and nightly processing jobs. However, this type of integration introduces lengthy time gaps and delays between when data is generated and when it is processed. This can introduce an assortment of problems, especially for companies in our modern business climate with an expectation of immediate and current data access.
Read More





