Using Apache Camel to implement enterprise application integration (EAI) is growing

Source: Internet
Author: User
Tags file system ftp apache camel mule esb

The need for IT projects is often changed, including the need to integrate with other systems. The ability to respond quickly to such changes is critical to the success of a project, so the software and development process must do so. Fortunately, enterprise application integration (Enterprise application INTEGRATION,EAI) provides us with all the knowledge, technology, and best practices in a creative way in building scalable, maintainable, and capable integration solutions.

However, most integration scenarios pose a dilemma: although they are full-featured and productive for harsh environments, significant up-front investment is required to start learning, deploying, and maintaining systems.

For this reason, the temporary solution looks attractive when faced with simple integration requirements. But they become difficult to maintain and integration requires increased efficiency. Using EAI best practices will solve this problem, but if they do it themselves, it will take some effort and knowledge of how to do things right. At first the solution to the least resistance might end up as a cul-de-sac.

So, when faced with simple and complex integration tasks, how can we avoid early investments while at the same time accomplishing our tasks efficiently? In this article, the Apache camel that I've introduced will provide a solution. I will demonstrate that camel can solve complex integration challenges that allow you to use EAI best practices and be easy to get started and mastered. At the same time, Camel allows you to focus on delivering business value without having to deal with the complexities of some frameworks.

I will demonstrate this through a real example of the challenges of typical integration and understand how camel can help us address these challenges. Integration scenarios are usually simple at first, but with the advent of new integration requirements over time, these examples are rendered in such contexts. Every time I'm asked how camel meets these needs, its main focus is on managing complexity and maintaining high productivity.

In my opinion, I chose the Apache camel because it provides an excellent and lightweight alternative to complete ESB products such as service Mix, Mule ESB, Openesb, and Jbossesb. Its competitor may be spring integration, and if your project already uses SpringSource technology, the latter is a particularly worthwhile option to consider. You will see that you can also use camel and spring. Gunnar Hillert has further discussed the alternatives here.

A simple start

The beginning of integration is usually simple. For example, get some files from an FTP server and place them in the local file system. In this scenario, a do-it-yourself solution (do-it-yourself) looks appealing. But let's look more closely.

A do-it-yourself solution might look like this:

public class Ftpfetch {public static void main (string[] args) {ftpclient ftp = new FtpClient ();  try {ftp.connect ("host");//try to connect if (!ftp.login ("Camel", "Apache")//Login to
                  server {ftp.disconnect ();
              Return
 
              int reply = Ftp.getreplycode (); if (!
                  Ftpreply.ispositivecompletion (Reply)) {ftp.logout ();
                  Ftp.disconnect ();
              Return
 
              } ftp.changeworkingdirectory ("folder"); Get output stream for destination file OutputStream output = new FileOutputStream ("Data/outbox/file.xml")
 
              ; Ftp.retrievefile ("File.xml", output);
 
              Transfer the file Output.close ();
              Ftp.logout ();
 
        Ftp.disconnect (); catch (Exception ex) {ex.printstacktrace ();
 
        finally {if (ftp.isconnected ()) {try {ft
                     P.disconnect ();
                     catch (IOException IOException) {ioexception.printstacktrace (); }
              }
         } 
     }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.