| |
Struts Tutorials:
Struts2 Tag CheckBoxList , Checkbox, Iterator, IF
Struts2 Tag Library Example
Struts2 Tiles Example
Struts2 Tiles I18N Example
Struts2 Questions
Struts Tiles I18N Example
Struts Eclipse MVC
Struts2 Tags
Struts2 Example and Tutorial
Struts MVC
Struts2 Validation
Hibernate Tutorials:
Hibernate Case Study
Class Hierarchy Persist Example
Using Hibernate Interceptor
Hibernate Questions with Answer
Hibernate Many-to-Many Mapping Example
Hibernate one-to-many Mapping Example
Hibernate and ORM tools
Spring Hibernate Example
Hibernate SessionFactory Example
Hibernate Mapping Class Hierarchy
Hibernate Questions
Hibernate SessionFactory Questions
Spring Hibernate Example:
Spring Hibernate Case Study
Written By : Amit
Title :
Data migration tools
Description :
Data migration tools Java Open Source More...
|
Written By : Amit
Title :
Application development on JBoss
Description :
Using Java Technology More...
|
Written By : Amit
Title :
Mule ESB
Description :
example applications integrated More...
|
Written By : Amit
Title :
Mule ESB File Transport
Description :
Example Scenario More...
|
Written By : Amit
Title :
Mule ESB JMS Transport
Description :
Example Scenario More...
|
Written By : ISHTEK
Title :
Open For Discussion
Description :
Design Following Requirements More...
|
| Tags/Keywords : Mule ESB, Example, Mule Example, Mule File, File Transport, Mule Transport Author : Amit Date (Year/Month/Date): 2010-05-16
A very simple example on using File Transport - using Mule as ESB | |
Please be informed that NONE of the design/code/matter from this page is claiming to be some
sort of best practice and we DO NOT expect any of our visitor/reader of this page to assume
this as some sort of best practice for any context and should not be using this as it is
without appropriate evaluation.
This page intends only to provide bits and pieces of known ways for doing some sort of example
and may not be fit for any other purpose.
In spite of all precautions taken to provide accurate and avoid any typo in these pages,
there might be some issues like grammatical mistakes and typo being observed in these pages,
We extend our sincerest apologies for the same.
In this writeup I am going to walk you through the way I
started to use Mule as ESB. I am assuming that you have
prior knowledge of Java, Mule and ESB basics.
If you want to have basic understanding of Mule, before
starting to go through this article, I recommend/suggest
to go through the documentation from Mule website.
Mule website
-> http://www.mulesoft.com/
-> http://www.mulesoft.org/download-mule-esb-community-edition
-> http://www.mulesoft.com/esb-integration-resources
Mule as ESB has quite a large set of articles, documentation
available on some third party sites as well.
Other parties articles and documenation
-> http://today.java.net/pub/a/today/2007/07/31/exploring-esb-patterns-with-mule.html
-> http://www.devx.com/enterprise/Article/38115
-> http://www.javaworld.com/javaworld/jw-10-2009/091005-mule-cat.html
Once you have basic understanding of Mule and its various
functionalities, such as
What is a Endpoint?
What is a inbound/outbound endpoint?
What is a Router?
What is a Transport?
What is a Message?
What is a Transformation of Message?
What is a Component?
What is a Service?
Answer to all these questions from Mule specific point of
would make this example scenario much easier to uderstand.
As I shall try to touch upon all these points with respect
to some example code and not devote much time towards
explaination of all these questions.
In my understanding the very purpose of any ESB is to
provide a platform for de-coupling various external
applications to work seamlessly without worrying much
about impact of any additional application introduced
or updated, that is to be made part of the already running
set of integrated applications.
For example, suppose we have applications A, B, C are
all operated and interacted among one another, being
attached to some common protocol,
A B C
| | |
----------
----------
Now with addition of another application D, in the above
diagram should not mandate to look at already running
and integrated applications A, B, C as far as any change
is concerned.
A B C
| | |
----------
----------
|
D
So in my thinking in the above pictorial representation,
the parallel bars/dotted line can be represented by
Mule as ESB.
Suppose there is an application A that is writing a file
to some folder within a filesystem, and as soon as this
file is written onto the folder, another application D
is designed to receive this file from some another folder
from the same filesystem. This means both these applications
are having separate folders to work with.
Now how can these applications from this scenario be integrated
so that there should not be any change in code on either
applications.
I know this is a very very simplified example just to understand
how various pieces fit in here while using Mule as ESB.
So let us try to achieve a file movement functionality using
Mule, and this will provide a viable solution to the above
scenario requirement where application A puts a file in a
folder X , as soon as this file X is placed in the folder,
listener from Mule ESB will pickup the file and pass this
as message payload to another output folder Y, from this
folder application D is supposed to pick up this file
and do whatever it wants to do with this file.
Just not to deviate from the main objective of this example,
I shall only focus on the integration strategy as far as
Mule is concerned. So here I have to provide configuration
file to the Mule Framework and try to make Mule Framework
listen for a file in an input file folder and automatically
move any file that is placed in this input folder to another
file folder, that's it.
I started with the Mule standalone version 2.2.1 :
As per my understanding, I followed following steps
need not be the right way to setup Mule, so please
refer Mule specific documentation/License before use:
Step 1:
Setup Mule Standalone version 2.2.1 from the Zipped
file from the Mule Download page:
Step 2:
Created a project folder structure as below,
Sample
|__ conf
| |___ [sample-config.xml]
|
|__ src
|___ source folder
As I don't have any component that can be configured
to be called in the process of this file transport
mechanism, so the src folder is blank as of now.
Step 3:
So the sample-config.xml file is the only configuration
file that I have to make this objective of file movement
achieved, wow.... so simple, isn't it!!!
Let us go through this sample-config.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.2
http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/file/2.2
http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd">
<description>
This is my first example/sample using Mule
</description>
<model name="sampleExample">
<service name="sampleService">
<inbound>
<file:inbound-endpoint path="<b>c:/test</b>"/>
</inbound>
<outbound>
<!-- <pass-through-router>-->
<message-chunking-router>
<file:outbound-endpoint path="<b>c:/test1</b>"
outputPattern="\[ORIGINALNAME\]"/>
</message-chunking-router>
<!-- </pass-through-router> -->
</outbound>
</service>
</model>
</mule>
|
As you might have noticed above configuration, there is a
schema definition for the file (2.2) with appropriate XSD file.xsd.
We have got the model name as sampleExample, and service name as
sampleService. inbound is the file with endpoint as the path for
the directory (in this example it is c:/test, but it can be any folder
per se), and the outbound is another folder with the path as c:/test1
for this example. The outbound is having a message-chunking-router,
whereas a pass-through-router can be used instead.
Step 4 :
In order to run this example, I had to mention MULE_HOME
environment variable as the root folder of the Mule installation
local directory, and mention the sample-config.xml file as the
config parameter to the mule.bat file from the Mule installation
bin folder.
mule.bat -config <<file-folder-path>>/sample-config.xml
This is using the standalone version 2.2.1 of Mule.
Step 5:
Once the above process is runing successfully...
I just placed a dummy file in the input folder, just to observe
that this file is moved to the output folder automatically.
Hope this helps in whatsoever manner you think it works.
Please send in your suggestions/comments by using following
online form.
|
|
|
|
| Home >>> Open Source Project Ideas >>> Mule ESB File Transport >>> Example Scenario |
|
|
Visitor/User referred related external URL:
(Visible upon review and approved by this site Administrator)
|
|
|
|
|
<- requires login | Log in or Register | |
Copyright © 2008-2010, Interview-Questions-Tips-Forum, All Rights Reserved. | CONTACT PRIVACY POLICY DISCLAIMER |
| |  |
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners
This web site's Terms of Use and Disclaimer :
This web site provides some of the information about various technologies, example code, tips, tutorials etc. Like any printed materials,
content of these pages may become out of date over a period of time. Therefore all visitor/users of this web site are requested/advised
to refer to the originating parties/sources for the latest changes and happenings for detailed information. This information is not
intended to be a substitute for the original reference provided by the originating parties/sources. These examples with source code or
without source code, have not been thoroughly tested under all conditions. Interview-questions-tips-forum.net therefore, cannot guarantee
or imply reliability of these example source code or programs.
By accessing and using this website in any ways, including, without limitation, browsing the website pages, using any information, using
any content and/or downloading any materials, you agree to and are bound by the terms of use described in this page and Usage Terms and Conditions.
If you do not agree to all of the terms and conditions contained in the terms of use described in this page and
Usage Terms and Conditions, do not use this website in any manner. If you are using the website on behalf of your
employer, you represent that you are authorized to accept these Terms of Use on your employer's behalf.
All Trademarks are property of their respective owner. Appropriate measure is being taken for providing accurate and up-to-date
information but like any printed materials, these blog(s)/contents may eventually be outdated one day, so if you are using any of these
information, please refer original content/documentation from respective sources. And under no circumstances shall the Author of these
contents and/or this web site be liable for any loss, damage, expense incurred or suffered which is claimed to have occurred because of
usage of the contents of this web site. If you have any questions/queries/feedback/suggestions then please write to this web site owner
at contact.
|  |
|
|
|
|
|