ESB
What is ESB? An Enterprise Service Bus (ESB) is fundamentally an architecture. It's used to integrate applications together over a bus. ESB products enable s to build this type of architecture .
Why ESB? To decouple the services and allowing to communicate without dependency.
Point to point communication if we have two services like acounting service and crm service. scenario
ing service want to prepare invoices, when ever it want to prepare invoices it need customer details which are retrieved from crm service. So now if we integrate these two services with point-to-point communication then the ing service will directly talk to crm service. If the crm service divided into two services ,one service produced with rest service and another with jms. If any one service is down then the system will crash the application never work properly. If end point of the service changes (ip changed) we need to update the address in all the services also.
Point to point communication
for every protocol we need a adaptor for converting the mesage. Along with adaptor we may require transformer (xml to java) jms to soap.
Communication with ESB Here Services will not talk directly with each other in b/w those one broker is existed that is mule (esb). Every service with mule only so there is no pointto-point communication.If we change service address, Just Change that address in configuration of mule . When ever one service want to communicate with another service it'll put message in esb. All the applications are talking with that service.
Communication using esb
Mule esb internally having converters and transformers to convert data
Message: The central part in mule is message
Message source flow Message processors
Message Source is responsible for bringing a message into flow then the processors will execute and perform some logic. Message processors: It can be a java component where we write business-logic. it can be a transformer or filter (to accept/reject your message) or router (to route message) End point which is actually responsible for sending/receiving the messages .
Message having headers(properties) and payload and attachment. In http req there will be payload as well as headers. If post req payload will become payload of my message, if any attachment came that will be added to attachment. End point is responsible to convert http protocol message to mule message there will be a adaptor for each protocol so endpoint like a adaptor.
Http endpoint recieve http request and it will start a server and listen on port. What ever we configure port for http end point in mule configuration file like 9999. internally end point using some connectors. So end point will start listening on this port. Http having inbound and out bound. Http in bound : if message comes into the flow Http outbound : message goes from the flow to out of the flow.
We are having variables like session variables and flow scope variable we can also create our own var in normal flow Session var: we can access these var in other flow also with in the same application. Flow scope : these will access within that flow only.
Property Transformer : use to set properties to outbound scope of a message. Once message hit the outbound-endpoint all the properties in the outbound scope are sent with the message. <set-property propertyName="time" value="#[server.dateTime]doc:name="Property"/> Access Property variable : Outbound property : #[message.outboundproperties.'time''] Inbound property : #[message.inboundproperties.'time''] Variable Transformer : with in the flow appllicable <set-payload value="#[sessionVars['time']] " doc:name="Set Payload"/>
IDE
:
Mule provided an ide like eclipse. So that we can work on the mule ide itself. Or else we can add a plugin of mule in eclipse also (Anypoint studio). Server : Mule provided server like stand alone server to deploy the applications. Its a trial version. To deploy the applications for free, we need to embed the mule to tomcat. (by adding configuration and libraries in tomcat we can work with mule easily).