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.18
List Price:  €95.97
You save:  €28.79
£55.86
List Price:  £79.80
You save:  £23.94
CA$97.87
List Price:  CA$139.82
You save:  CA$41.95
A$107.62
List Price:  A$153.75
You save:  A$46.13
S$94.24
List Price:  S$134.64
You save:  S$40.39
HK$544.83
List Price:  HK$778.36
You save:  HK$233.53
CHF 62.54
List Price:  CHF 89.34
You save:  CHF 26.80
NOK kr774.97
List Price:  NOK kr1,107.14
You save:  NOK kr332.17
DKK kr501
List Price:  DKK kr715.75
You save:  DKK kr214.74
NZ$119.95
List Price:  NZ$171.37
You save:  NZ$51.41
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,361.58
List Price:  ৳11,945.63
You save:  ৳3,584.04
₹5,909.84
List Price:  ₹8,442.99
You save:  ₹2,533.15
RM312.71
List Price:  RM446.75
You save:  RM134.04
₦118,484.88
List Price:  ₦169,271.38
You save:  ₦50,786.49
₨19,443.22
List Price:  ₨27,777.22
You save:  ₨8,334
฿2,412.28
List Price:  ฿3,446.26
You save:  ฿1,033.98
₺2,418.32
List Price:  ₺3,454.90
You save:  ₺1,036.57
B$406.01
List Price:  B$580.04
You save:  B$174.03
R1,267.89
List Price:  R1,811.35
You save:  R543.45
Лв131.37
List Price:  Лв187.69
You save:  Лв56.31
₩98,301.65
List Price:  ₩140,436.95
You save:  ₩42,135.30
₪259.10
List Price:  ₪370.16
You save:  ₪111.06
₱4,125.14
List Price:  ₱5,893.31
You save:  ₱1,768.17
¥10,832.35
List Price:  ¥15,475.45
You save:  ¥4,643.10
MX$1,429.79
List Price:  MX$2,042.64
You save:  MX$612.85
QR255.18
List Price:  QR364.56
You save:  QR109.38
P956.90
List Price:  P1,367.06
You save:  P410.16
KSh9,061.51
List Price:  KSh12,945.58
You save:  KSh3,884.06
E£3,475.01
List Price:  E£4,964.52
You save:  E£1,489.50
ብር8,566
List Price:  ብር12,237.67
You save:  ብር3,671.66
Kz63,900.87
List Price:  Kz91,290.87
You save:  Kz27,390
CLP$69,057.73
List Price:  CLP$98,658.13
You save:  CLP$29,600.40
CN¥506.93
List Price:  CN¥724.22
You save:  CN¥217.29
RD$4,217.06
List Price:  RD$6,024.63
You save:  RD$1,807.57
DA9,397.90
List Price:  DA13,426.15
You save:  DA4,028.25
FJ$159.29
List Price:  FJ$227.57
You save:  FJ$68.27
Q540.13
List Price:  Q771.64
You save:  Q231.51
GY$14,638.82
List Price:  GY$20,913.50
You save:  GY$6,274.67
ISK kr9,776.20
List Price:  ISK kr13,966.60
You save:  ISK kr4,190.40
DH703.91
List Price:  DH1,005.63
You save:  DH301.72
L1,275.33
List Price:  L1,821.98
You save:  L546.64
ден4,132.76
List Price:  ден5,904.20
You save:  ден1,771.43
MOP$561.01
List Price:  MOP$801.48
You save:  MOP$240.46
N$1,268.91
List Price:  N$1,812.81
You save:  N$543.90
C$2,574.70
List Price:  C$3,678.31
You save:  C$1,103.60
रु9,449.77
List Price:  रु13,500.25
You save:  रु4,050.48
S/265.32
List Price:  S/379.05
You save:  S/113.72
K281.71
List Price:  K402.47
You save:  K120.75
SAR262.77
List Price:  SAR375.40
You save:  SAR112.63
ZK1,934.92
List Price:  ZK2,764.29
You save:  ZK829.37
L334.42
List Price:  L477.77
You save:  L143.34
Kč1,702.59
List Price:  Kč2,432.37
You save:  Kč729.78
Ft27,646.05
List Price:  Ft39,496.05
You save:  Ft11,850
SEK kr772.42
List Price:  SEK kr1,103.50
You save:  SEK kr331.08
ARS$70,259.44
List Price:  ARS$100,374.93
You save:  ARS$30,115.49
Bs483.50
List Price:  Bs690.75
You save:  Bs207.24
COP$307,238.59
List Price:  COP$438,931.09
You save:  COP$131,692.49
₡35,641.51
List Price:  ₡50,918.63
You save:  ₡15,277.11
L1,768.23
List Price:  L2,526.16
You save:  L757.92
₲546,248.87
List Price:  ₲780,388.98
You save:  ₲234,140.10
$U2,983.14
List Price:  $U4,261.82
You save:  $U1,278.67
zł291.40
List Price:  zł416.31
You save:  zł124.90
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.