What is ESB and What is Mule?

Mule 4 Indepth Introduction to Mule
24 minutes
Share the link to this page
Copied
  Completed

Transcript

Welcome to my new course on level four. In this video, you're going to understand about the problems of point to point integration. What is an ESB? How ESB helps in solving this p2p integration? What is the idea behind an ESB and how it works? If you have already seen my mule three video course you can ignore this video and go to the next video because it's going to be mostly the same.

Okay? If you're totally new to mule four, and mule, please keep on watching. OK, so let me talk about the scenario first. Let's assume that I have a soap web service. Let's assume that this is a third party soap web service and they have exposed soap over HTTP actually, in So focus Transport Protocol Independent isn't? Yes, mostly we use soap over HTTP transport.

Let's assume that I have a third party web service soap web service. And I want to write an application which will consume this web service or this application is going to integrate with a third party soap web service. Whenever we are integrating with another application, I always look at how the coupling is there between my application and third party. So I always look at two types of couplings, loose coupling and logical coupling. What do I mean? So let's talk about first loose coupling.

Normally, whenever we have a soap web service, we'll be having a visit If I might, if I'm taking a traditional approach, normally I generate code from the wisdom and by using this generated code, I will consume my soap web service. But in this in this case, is my code loosely coupled with soap web service? What do I mean by loose coupling? loose coupling means if the implementation changes, the consumer need not changed. If you're done your integration in such a way, then you can say that your application is loosely coupled with the other application. In case of soap, let's assume that today the implementation of the soap web service is done using dotnet.

Let's assume that tomorrow the implementation is change to Java as long as the contract that means a whistle Same they think the client or the consumer needs to change the coordinate to change no right. As long as a contract is same even if the implementation details change the client need not change if you are using so for SDP. So okay you can say that the client and the service provider are loosely coupled with each other because any change on the implementation need not propagate to the client, the client need not change as long as it contract the same I'm saying Okay, so we understood that if I'm using soap or HTTP, I achieved loose coupling, but what about logical coupling? What do I mean by logical coupling? logical coupling means the service provider need not know who is a consumer and consumer need not know who is the service For if you integrate in such a way, then we can say that there is logical coupling between the client and the Service Cloud.

But take this case of soap or HTTP. If a client has to consume a soap web service client needs to know the endpoint is it. client needs to make a HTTP connection to the endpoint URL and then send the soap message. So client need to know the service provided. So there is no logical coupling if you are using soap over HTTP, but then how to achieve logical coupling. Let's take this another example.

As I told you, soap is not transport specific soap is Transport Protocol independent. Let's assume that the soap service provider is also acting posing soap over messaging. Okay. Now, if I have to write a client to consume the soap service, what I have to do is I have to create my soap enema XML, then wrap the soap enema inside JMS message. Let's assume that I'm using JMS Java messaging service. And let's assume that I have a queue broker managed queue.

Now what I have to do is on the client side, I have to create a soap envelop, create a JMS message whenever I say JMS message methods will have some headers and body. So body of this JMS message will be the soap envelop XML. There will be some headers. So the client has to create a JMS message and push it to the queue. Now the service provider will consume this message, take the body of the message, understand what it has to do and execute the logic. But then how can the service send the response back?

Can we achieve response in messaging? Yes. In messaging if you want response if the client needs the response, when we're trying to sending a message, client has to send a header colors reply to header. The value of this header should be the queue name at which it will listening for response. So let's assume that this is a reply to you. Now when our client is sending a message to this first queue, actual The methods will also contain reply to header the service provider will take the message and once the service provider sees the reply to hydrate understand okay the response has to be kept in the supply queue.

So, this will keep the response in reply to the consumer will read from the reply queue and take the response right. So, like that, even in messaging also we can simulate request reply, we can even achieve response also. So, in this case, the client the client application is consuming the soap service Do you think it needs to know who is service provided? Need, the client will just push a message to this queue. Somebody will take from here and process a message. So, the client need not know who is service provider and the service provider need not know who is a client So did it seem logical coupling?

Yes, I achieved logical coupling, is it that it's okay to logical coupling? But don't you think that I have introduced the warhead of a Message Broker now? Yes. So what is the idea? Now? What will be the next idea?

Let me show you an improvement of my idea. Now. Again, let's assume that this is a soap web service. Now, and this is my application. In my application, let's assume that this is my code. In my code, through my code, I want to consume the soap web service.

So what should I do? What I will do is in my code, I will create a message in my One proprietary format. When I say a message, every message will have some headers, the body the payload. So method means it's like a data structure is it, it contains some headers and body. If I'm talking in terms of Java, I can say a data structure is nothing but a class that let's assume that whenever my code wants to consume, my code will create a message in my own proprietary structure, which contains some headers as well as payload and keep that message in a in memory queue. Let's assume that I can configure or in memory queue.

So my code will put the message on this in memory queue. And this message, is it the soap message? No. It is a message in my one proprietary format Now, what I want is I want some way to configure an adapter a component, which can read from this in memory to take this proprietary message, convert this proprietary message because soap message, when I say converting my proprietary message soap message, even soap message also will contain headers and payload. Yes. So these headers, a copy here and payload also is copied here.

So like that, if that can be adopted. Or even I can say in this case, a soap adapter, which can convert my proprietary message to a soap message. And if the soap adapter can be configured to actually make a soap request to this third party, then, whatever advantages I was getting earlier, I'm getting it through In memory cube, is it I have avoided the overhead of a broker. Somehow, if I can use this mechanism, I can achieve logical coupling is it. So what is so great about achieving logical coupling? So I will tell you one interesting fact, if you have configured like this.

So I'm saying that I'm configuring a memory cue, and I'm configuring a swap adapter, right? This is not my code. It's just a configuration. If I could somehow configure this, I'm saying right. Now, what if the third party provider who is exposing the services through soap says that okay, we are going to stop soap support from next few months, and the same functionalities exposed over rest. Do you think your code whatever you have written here, the code, the thing, the code needs to change, no, the code will remain same, the code will push the proprietary message to this queue.

What else needs to change is the soap adapter here, I'll configure rest adapter is it see without changing my call, I'm able to migrate from soap web service consumption to rest consumption. So that is the power of logical coupling. So my application is logically coupled with third party and who is my application need not know, the code, whatever I am writing here need not know whether my application is consuming a soap or rest. Because it's creating a message in some generic format. The adapter will take care of converting this to a soap message or a rest message as it so I had saved logical coupling in this way. But But I do Want to create logic for creating these in memory queues, creating this soap adapter, rest adapters, etc.

I'll be happy if there is some library, which can provide me a way to configure in memory queues, rest adapters, soap adapters, etc. Yeah, there are a lot of libraries which can provide that. But before we go ahead, let me introduce you to few more requirements. And then I'll talk about those libraries. Okay, a new requirement. Again, assume that this is my soap service.

And this is my application. And here is my code which wants to consume soap web service. Whenever through my code, if I want to consume a soap service, what I do, I create a message in my own proprietary format and keep it inside the in memory queue. Okay. Now the requirement is whenever a message comes in the queue, we don't want to invoke soap web service, we want to filter the messages. That means, whenever a message comes into this queue, I want to check on the incoming method is there is there any condition to be satisfied, if some condition is satisfied, then I want to further process my methods otherwise they want to drop my message.

So, what I can do is I can configure something like a filter filter is a component which can take this message from the queue, evaluate some condition, if the condition is not satisfied, it will drop the methods. If the condition is satisfied it keep the message over. And now, here I can add the soap adapter to the soap method. What I mean to say sometimes we don't want to process all the methods We want to execute some conditional check. If some condition is satisfied, then only I want to further process. So sometimes I need a filter.

Okay. Let me tell you about one more requirement after the message is filtered. Let's assume that the other third party application requires data in XML format. But my logic, whatever here, it has data in JSON format. That means if my code is creating a message, the payload is a JSON object, JSON data. But the other party requires the data in XML format.

So what I might want to do is, I might want to configure a transformer which can take this message, convert the JSON to XML and then put it over and under in memory. Then here I can configure the corresponding adapter which can invoke the third party service. Right. So what I mean to say is sometimes we need a transformer to transform the data from one format to another format. Yes, this is a common requirement. Okay.

Let me elaborate further and let me tell you one more use case a very good use case. Assume that I'm developing an application for something some website like this. Smart bricks.com is a website which I saw here, this sample if I want to purchase an iPhone, what I can do is I can search for my iPhone here. Let's say I want to purchase some iPhone this iPhone seven I said it is showing me the reverse And let's say I selected this product. Then here, this website is showing, comparing the prices from Amazon Flipkart, click shop clothes from various ecommerce websites. So this smart prex.com website is actually making calls to Amazon Flipkart, Tata click and shop close getting the results and showing the prices from all these websites.

Let's assume that I am developing an application for such smart press calm. So now the scenario will be like this from the browser. Whenever a request comes, this is a browser. From the browser when the request comes, the request will come to a web application and this web replica He needs to get the prices from, say, Amazon, Flipkart, whatever shop clothes etc. So my web application needs to integrate with third party applications like Amazon, Flipkart, etc. Instead of writing such integration logic in a web application, I will read them separately.

So what assume that this is another application which I'm writing. Whenever of application wants to get the results, it will invoke my code. So I assume that this code gets kicked off. What this code will do is create a message in proprietary format and keep it in this queue. Then maybe I'll add a filter The filter will evaluate some condition, and if everything is fine, it'll keep them with your next cube. Then maybe let's assume that I'll add a transformer and the transformer will transform and then keep them over.

And now what I want is another method comes here, I want a router, which can create a copy of the method and put them inside for other tools. Okay. I want a component which will keep a copy of the message in all the fork iOS, and I want a component to spin four threads, which will concurrently what they do is which will concurrently invoke homies on Flipkart or other third party services. So basically what I want is my message should be routed to other third parties concurrently. Wait for response from all third party services, aggregate the results and do the aggregated results back to the web app web application. And then the web application will show the results on the browser.

So basically, after transformation, what I want is a router which can concurrently send messages to third party applications. Get the responses, aggregate them and go back. So sometimes we need a filter window transformer we need a router and we need a wide variety of adapters one adapter which knows how to talk with a major on adapter maybe if you will know how to talk to Flipkart etc right By seeing the diagram, do you see that the message is going from one location to another location through the setup channels, transformers, filters, outers and adapters? Yes. Normally, in a bus, we travel from one location to another location. Here also my method is traveling from one location to another location through the set of queues and all these adapters Transformers routers.

So I can say that I've configured a bus like infrastructure. Yes, I'll configure a bus like infrastructure where my methods can travel from one location to another location. So any framework, which provides me a ready made way to configure these in memory cues, filters, transformers, routers, etc. We call such frameworks or libraries as bas frameworks. Now you understood what is a bus, but what is this enterprise service bus if you need to understand, first you need to understand what is the meaning of Enterprise Services. If you take in your enterprise in your company, you might be having a lot of applications for all the applications, we need some common facilities like transformation sorry, transactions, security, pooling, etc.

So, this transfer transactions security pooling etc are services which are required by many of the applications in your enterprise right. So we can say that these are Enterprise Services transaction security, pooling, remoting, etc. Any bus, which provides declarative transactions declarative security, declarative tooling etc we call such bas frameworks as ESB s enterprise service bus right. So now you understood what is an ESB so if I tell you examples of what are ESB frameworks there are a lot of frameworks like Apache camel is one of the very good ESB mule is another ESB so like that there are a lot of ESB s in the market. I want to clearly say that mule is one of the ESB But not only that, you will is much more than that we will understand what all facilities mule will provide. But as of now understand that newless ESB it provides all the ESB functionalities that means it is a framework which is providing me a way to declaratively configure in memory cue was filters Transformers routers So if you are using ESP for integrations, you can avoid the problems, whatever you're facing with Point to Point integration.

Actually earlier if my application is directly talking to other service, it is a point to point integration. We understood that whenever you are doing Point to Point integration, we won't be achieving loose coupling and logical coupling. But if you are integrating your application, using ESB, you can avoid all the problems of point to point integration. So that's about the introduction to what is meal. But noodle can do a lot of other things. We'll understand its capabilities in next few videos.

See you in the 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.