Mule Basics Part 1

Mule 4 Indepth Mule Basics
26 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€67.35
List Price:  €96.21
You save:  €28.86
£55.83
List Price:  £79.77
You save:  £23.93
CA$100.76
List Price:  CA$143.95
You save:  CA$43.19
A$112.23
List Price:  A$160.33
You save:  A$48.10
S$95.14
List Price:  S$135.93
You save:  S$40.78
HK$543.62
List Price:  HK$776.63
You save:  HK$233.01
CHF 63.04
List Price:  CHF 90.06
You save:  CHF 27.02
NOK kr797.48
List Price:  NOK kr1,139.30
You save:  NOK kr341.82
DKK kr502.49
List Price:  DKK kr717.87
You save:  DKK kr215.38
NZ$124.10
List Price:  NZ$177.29
You save:  NZ$53.19
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.18
৳8,361.55
List Price:  ৳11,945.58
You save:  ৳3,584.03
₹5,962.79
List Price:  ₹8,518.63
You save:  ₹2,555.84
RM314.04
List Price:  RM448.65
You save:  RM134.61
₦108,335.42
List Price:  ₦154,771.52
You save:  ₦46,436.10
₨19,495.71
List Price:  ₨27,852.21
You save:  ₨8,356.49
฿2,390.81
List Price:  ฿3,415.60
You save:  ฿1,024.78
₺2,467.44
List Price:  ₺3,525.07
You save:  ₺1,057.62
B$434.14
List Price:  B$620.23
You save:  B$186.09
R1,296.68
List Price:  R1,852.48
You save:  R555.80
Лв131.68
List Price:  Лв188.12
You save:  Лв56.44
₩102,198.93
List Price:  ₩146,004.73
You save:  ₩43,805.79
₪256.56
List Price:  ₪366.53
You save:  ₪109.97
₱4,090.81
List Price:  ₱5,844.26
You save:  ₱1,753.45
¥10,994.99
List Price:  ¥15,707.80
You save:  ¥4,712.81
MX$1,408.98
List Price:  MX$2,012.91
You save:  MX$603.93
QR255.09
List Price:  QR364.43
You save:  QR109.34
P967.82
List Price:  P1,382.66
You save:  P414.84
KSh9,046.20
List Price:  KSh12,923.70
You save:  KSh3,877.50
E£3,562.49
List Price:  E£5,089.49
You save:  E£1,527
ብር8,907.19
List Price:  ብር12,725.10
You save:  ብር3,817.91
Kz63,830.88
List Price:  Kz91,190.88
You save:  Kz27,360
CLP$69,323.69
List Price:  CLP$99,038.09
You save:  CLP$29,714.40
CN¥510.80
List Price:  CN¥729.75
You save:  CN¥218.94
RD$4,245.36
List Price:  RD$6,065.06
You save:  RD$1,819.70
DA9,465.07
List Price:  DA13,522.10
You save:  DA4,057.03
FJ$162.39
List Price:  FJ$232
You save:  FJ$69.60
Q539.11
List Price:  Q770.19
You save:  Q231.08
GY$14,638.77
List Price:  GY$20,913.42
You save:  GY$6,274.65
ISK kr9,772.70
List Price:  ISK kr13,961.60
You save:  ISK kr4,188.90
DH703.98
List Price:  DH1,005.73
You save:  DH301.75
L1,291.33
List Price:  L1,844.84
You save:  L553.50
ден4,143.97
List Price:  ден5,920.21
You save:  ден1,776.24
MOP$559.97
List Price:  MOP$800
You save:  MOP$240.02
N$1,289.45
List Price:  N$1,842.15
You save:  N$552.70
C$2,574.80
List Price:  C$3,678.44
You save:  C$1,103.64
रु9,534.71
List Price:  रु13,621.60
You save:  रु4,086.89
S/260.99
List Price:  S/372.86
You save:  S/111.86
K283.85
List Price:  K405.52
You save:  K121.66
SAR262.91
List Price:  SAR375.60
You save:  SAR112.69
ZK1,936.45
List Price:  ZK2,766.47
You save:  ZK830.02
L335.12
List Price:  L478.77
You save:  L143.64
Kč1,694.03
List Price:  Kč2,420.15
You save:  Kč726.12
Ft27,771.44
List Price:  Ft39,675.18
You save:  Ft11,903.74
SEK kr774.38
List Price:  SEK kr1,106.30
You save:  SEK kr331.92
ARS$71,792.58
List Price:  ARS$102,565.23
You save:  ARS$30,772.64
Bs484.55
List Price:  Bs692.24
You save:  Bs207.69
COP$307,165.41
List Price:  COP$438,826.54
You save:  COP$131,661.12
₡35,530.54
List Price:  ₡50,760.09
You save:  ₡15,229.55
L1,777.33
List Price:  L2,539.15
You save:  L761.82
₲546,250
List Price:  ₲780,390.60
You save:  ₲234,140.59
$U3,115.91
List Price:  $U4,451.49
You save:  $U1,335.58
zł287.82
List Price:  zł411.19
You save:  zł123.37
Already have an account? Log In

Transcript

In this video we are going to understand about some real basics. We'll create one mule application using any point studio, which is nothing but the ID for developing mule application. We'll create a mule project and I will describe the structure of a mural project. We'll understand what is a mural flow or the neven pricer? How does a mural event look like? Or a transformers and points etc.

I'll show you how to debug a mule flow. What is the structure of a mule event in detail? We'll see how to track even data as an as an event moose in moto moose otters application. Then I'll introduce you to data view which is nothing but mule expression language. After completing this video, we will have to work on an exercise And we'll you will be implementing a basic flow by following my document. Okay, let us get started.

First of all, I want to show you how to download any point studio and how to use it. So, I'll go to Google and just Google for any point to download. So it takes me to the first link, I'll go to this first link. And here, you can select your operating system. Let's say I'm using Windows, select your windows 64 bit or 32 bit and select and you give the details and click on download. You will download the any point to do now, I have already downloaded this, this is the zip file right now the version of any points to do which I'm using is seven dot three.

I have extracted the zip file into here There is no installation required for any points to you just extraction. So here I have extracted and if I want to start any points Today I'll click on this icon. That's all this will start any points tutorial. Okay, so the first thing whenever it is starting, it's asked it'll ask you for a workspace, a folder where all the created projects should be stored. So what I will do is I'll create a new folder, set Ws workspace and I will give this folder as a workspace here. Okay, lunch.

No, see here in this folder, a dot metadata is created. Every workspace will have this dot metadata. Any points ga will actually create some metadata in this folder. Actually is any points to do is nothing but Eclipse If you know a tool called as Eclipse which is used for actually developing Java project, Java applications, this any point studio is built on top of Eclipse only. Okay, so once you open this any point should have a first time you'll see a welcome screen is closes. Here is there any point story now there are a lot of windows which are open here.

I'll explain them. But before that I want to create a new application a new project basically, I'll go to File, New, new project. So last me for all the project details I'll give I'll give the project name as mule basics and Here there is something called as runtime. Basically, I told you that we deploy our real applications on mule runtime. mule runtime is actually a licensed software. But in any points to do this mule server mule runtime is available as a plugin by default for this version of any point studio mule server runtime with version four dot one dot four E is already built in.

So I want to deploy applications on this mule server four dot one dot four e I selected this Okay, then what is the default location of my project my project will be stored in Ws folder whatever I created right now. Okay, let it go. I will just take all defaults and then finish. So this will create one mule application and it has just wait Okay, so here in the package explorer, they can see that project has been created. I expand it you can see this structure right so this outline window as of now I don't want we'll discuss about sled and unit alysus and clauses closes. Now you can see that there's a folder called SRC main mule which contains an XML same name as a project name.

So this is the XML where we write flows rate the current configuration for a flow. We'll discuss more on this XML next. So understand that in SRC main mule folder, we will contain we will write XML files, which contain flow definitions. src main Java should contain the Java code if any. src main resources should contain any condition. files like XML files or properties files or XML files etc.

Src test Java should contain any test cases whatever you want to write in Java and SRC test the M unit will contain something called as M unit test cases. Don't worry about what is this m unit right now. We'll discuss m unit in detail next. src test resources will contain the configuration files which are specific to testing okay. And this project actually can see here, this is form dot XML. Actually, mule mule project is internal nothing but a Maven project.

What is this Mavin Mavin is a build tool, which we normally use for building any Java applications. You might be knowing about what is this Maven if you're a Java developer If you are not a Java developer, I suggest you to actually Google for Maven videos on YouTube or so and go through some Maven basics. I'm not going to cover Maven basics here. I assume that you know what is Maven? So for every Maven project, there will be one POM dot XML POM stands for project object model. In this palm dot XML, there is a project tag and every project new project every Maven project is uniquely identified were combination of group ID, artifact ID and a question.

So here I'll use a group ID as my company comm.id. To learn online, the reverse of my website domain The project name I want to give as we will basics and the version. So we'll discuss about what is this packaging letter. Now here you can see coming down, there are dependencies. So by default in mule, there are two dependencies added mule HTTP connector dependency, mule sockets connector dependency. Basically if you add dependency here the corresponding libraries mule libraries for this modules will be automatically added to your project.

So by default two modules are at an HTTP module, which you can see it will HTTP Carter module sockets module. Alright, so since I added this dependencies, you should see the corresponding libraries in the path of my project. So If you see here in my project, actually mule is mood application is nothing but a Java application at the end, okay. So here in this little project you have Java jars added into the build path or class path. You can see that there is HTTP module added. Because there is HTTP connector dependency and sockets module added.

And also our our new application as I told you, it is a Java application, the JDK system libraries, the jars are also added. Here you can see they are in the pillar path. And all the mule server related jars are also present here, right? By default, okay, so now you understood that mule application is nothing but a Maven application. And we can declare the dependencies inside form dot XML. Okay.

Now, let me explain you my use case what I want to achieve. So what I want to do is, right now I want to create a simple flow where my flow will listen for HTTP requests and returns HelloWorld. Yep, so you know our whole course we're going to learn about a lot of good use cases. But I want to start with the hello world. So my real flow should be listening for HTTP requests. So I want a component to be configured in my mule flow, which will listen for HTTP calls at some port.

So I want to configure a component to listen for HTTP requests at a port called as, let's say 8081. So whenever any HTTP request comes in, This component should take it, right? convert the incoming HTTP message to a mule message and keep it inside a queue. Okay, what do I mean by HTTP message? Whenever any HTTP request is coming, every HTTP request will contain HTTP headers as well as body is it every HTTP request to contain some headers, request headers, HTTP headers, as well as body. So this first component should receive such HTTP methods.

And then what it has to do is just to create a message in mules proprietary format. So it has to create something called a mule message. What is mule message mule message is nothing but a data structure which contains two parts attributes and payload. It is nothing but data structure. If you are a Java developer can understand that mule methods is nothing but a class Java class which contains two important parts attributes and payload. So, now the incoming HTTP request has to be converted to a mule message.

So, in this case what should happen is HTTP headers should be copied as attributes HTTP request body convert us payload. So, this component should do such conversion. So, any such component which will take a request in To my flow, we call test inbound endpoint, inbound endpoint. Okay. In this case, I wanted the inbound endpoint to be using HTTP protocol right. So in this case, I need an HTTP inbound endpoint or in neural we say it as HTTP listener, which will be listening for HTTP requests.

So the first component in my flow is nothing but HTTP listener, listening on port 8081. And what is its responsibility? HTTP listener will listen for HTTP requests. When our HTTP request comes, it will contain headers and pair like this. It has to convert the HTTP request to mule message. What is the mule message?

Mule message is nothing but a database. lecture or we can assume it like a Java class, which contains two parts attributes and tailor. This HTTP listener has to populate these headers into attributes and body into payload. Actually what this inbound endpoint will do is it will create a mule message first which contains attributes and payload. Wrap it inside another object called as newly. Newly went is again another data structure or a Java class which contains two parts.

First part is nothing but the mule message. And second part will contain something called attributes, sorry, variables. We'll discuss about what these variables can contain later, but just understand that mule even contains two parts, mule methods and variables. Okay, so actually, this inbound endpoint will create a new event and we'll put that mule event object inside the next cue. Actually, in enterprise integration terminology, we call this in memory queues as channels. So from now onwards, I'll use a word channel instead of using in memory queue.

So the newly went is kept inside this channel. Now I want one transformer to take this message. And set the payload as HelloWorld. So I need a transformer to set the payload. So I'll configure a transformer and we'll call a set payload transformer. And this set payload will actually set the payload to HelloWorld.

And then the transform message I want to keep it inside another channel. Then I want to configure a logger which will log the payload of this mule message. So let us see I'll create a flow. So already you can see that in SRC main meal, there is an XML bill basics. This XML right now whatever you are seeing is graphical view of this XML. There's a tab called message flow and there's a tab called configuration XML.

If I click on the configuration XML tab here you can see the XML view of the file, the root tag of the XML is no, if I want to see graphical view of this, I'll click on message flow. So actually what I want is I want to create an empty flow. So I'll drag and drop and empty flow. Empty flow with HTTP right I'll just run that is drag and drop. Select HTTP from the mule palette on the right side and drag and drop this listener see, a mule flow is created. Very nice.

If I go to the XML view, and click on his XML view, see the XML is modified and here I have a flow tag where the flow name is mill basics flow There is one tag cross HTTP listener. I'll come back to this XML later, but let me go to this graphical view. So, flow has been created. I will just delete this listener from here by selecting delete. Right. If you see this is an empty flow, every flow will contain three parts.

There is some part called a source process, error handling, is it. Three, every flow will contain three parts source part should contain the inbound endpoints. So what I did right now was I dragged and dropped a module called us HTTP listener. So on the right side, there'll be a new palette from where we can drag and drop some components. Here. The two parts again, you're correct.

We will select I'll select HTTP right Here there is listener, I can drag and drop this listener. Basically on the left side of this mule palette, you are seeing modules there are two modules right now, HTTP module and sockets module. If you remember in pomerode, XML, there were two dependencies added one is HTTP module dependency and socket smart. So whatever modules are added as dependencies in form, you are seeing the corresponding modules on this left side. And whenever I select the porter module icon, whatever characters are available, they'll be visible on the right side. So now I want to drag and drop a listener into source pot.

Okay, this is my inbound endpoint. Now there is an error here is asking me to configure a connector configuration. Every endpoint needs to have something called connector configuration. Actually, I need my list. Not gonna listen on some port. I can configure on what port to listen using this connector configuration.

I'll click on this plus. Yep, here is a window where I can configure the protocol to be uses HTTP. If I want to use HTTPS Yes, of course I can configure here. I'm going with default right now. And the host is zero dot zero dot zero dot zero. This is nothing but localhost as of now.

And at what port I want. I want at 8081 I can even change the port if I want. Right? So I'm not going with other options right now. We'll discuss it later. I just say okay, based back here, I'm not specifying anything.

It will be by default slash. Okay. Now what I can do is I can say slash Hello He has a party slash Hello. That means now you can understand how to invoke this flow by making a request to localhost eight right one slash Hello. I gave it I can you hear slash Okay. Now as I told you what I want next how to configure set payload.

So I'll go to such pellet set. Yes, I can see set payload transformer, drag and drop it after the listener, very simple. If I drag and drop, it is coming. And once I click on Set payload, here, I can see value what does this value actually for this value? I can either hard code a string or I can right there's a function which is nothing but an expression. So right now I want to make it as hello world.

That's all I want answered in the parameters hello world, I didn't select this FX option. If we select this FX option it will switch to expression mode. We'll discuss about expression mode next. Then now I want to drag and drop a logger. This logger component i just drag and drop. In this logger, I have to write what to log actually I want to extract payload from the message as I told you message contains a mule message contains payload and attributes right.

So I want to extract the payload. So here I selected FX, switch to expression mode. Simply I write my hash message dot payload, save messages into properties payload and attributes dot payload. So, here I wrote a simple expression. This is actually nothing but a data v expression. The data expressions enclosed inside hash and square brackets right.

So whenever you are using this syntax, hash and square brackets here on this yet right or Data View expression, so we'll understand what in this data view transformation language later. But as of now, in the expression if I right message, it will evaluate to an object of mule message. As I told you here, this is the structure of mule message contains attributes and payload. So I will say dot payload I'll get the payload. Let me just run this. To run this application, I can just right click on the project, run s mule application, or simply I can right click on the XML and say run project.

That's all. So first what is happening is the any point studio is building your application using Maven build success. Then it is trying to start my application inside mule server four dot one dot four he right? Yes. So let's see what is happening and maximize it. The mule server runtime will be started and your application will be deployed in it.

Don't worry about what is happening. Once I start my mute server we'll discuss in detail later. I guess I want you to observe right now the server should start application should we deployed? Yes, you can see that the application mule basics, the status deployed. Now I want to give a request to what URL vocalist 8081 slash. Hello.

So I'll give a request I'll go to localhost 8081 slash Hello. Yep. See I got hello world displayed. That's nice. So I got the expected output. So we'll come knew the discussion of the same thing in my next video.

See you next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.