Using seda in mule

14
By Anirban Sen Chowdhary

Transcript of Using seda in mule

Page 1: Using seda in mule

By Anirban Sen Chowdhary

Page 2: Using seda in mule

SEDA is also known as staged event-driven architecture , is an approach to software architecture that decomposes a complex, event-driven application into a set of stages connected by queues.

This design avoids the high overhead associated with thread-based concurrency models, and decouples event and thread scheduling from application logic.

Source :- Wikipedia

Page 3: Using seda in mule

So, in simple words SEDA as a series of events sending messages between them.One main reason to use this architecture, is that we can fragment the logic into smaller pieces and can connect it and decouple each event, and is done mainly

for high performance and high control.

Page 4: Using seda in mule

Advantage with SEDA :-• Help to control on each event queue• The service can be well-conditioned to load• Preventing resources from being overcommitted when demand exceeds

service capacity.

Page 5: Using seda in mule

A staged event-driven architecture basically contains the concept of queue:-

Page 6: Using seda in mule

So, how can we implement SEDA in Mule ????

Page 7: Using seda in mule

As already mentioned in the definition of SEDA that A complex big flow is divided into multiple glow and the flows are connected to each other with a queue .. So we will be developing a similar kind of flows here to implement a simple example of SEDA architecture

Page 8: Using seda in mule

Let’s consider we have a following flows implemented in Mule :-

As you can see both the flows are connected to each other with JMS queue

Page 9: Using seda in mule

Now, if we look into our code we will find :-

You can see here, both the flows have processingStrategy="queued-asynchronous" and both are connected by a JMS queue. You can also see that all the message processors in both the flow are following SEDA ..

Page 10: Using seda in mule

The reason I have processingStrategy="queued-asynchronous" in both the flow is, Mule uses a queue to decouple the receiver thread from the rest of the flow. This means that once the receiver places a message into a queue, it can immediately return and accept a new incoming message. This specific type of queue implemented for the queued-asynchronous flow processing strategy is known as a SEDA queue.

Page 11: Using seda in mule

We can start our application and test it by hitting the url :-http://localhost:8081/jms on the browser and we will the following in our Mule console :-

Page 12: Using seda in mule

So, you can see a simple example of implementing a SEDA in Mule by dividing the flows and connecting them with a queue. But the important is the processing strategy of the flows which should be queued-asynchronous

For more information on SEDA please visit Mule documentation :-http://www.mulesoft.org/documentation/display/current/Flow+Processing+Strategies#FlowProcessingStrategies-TheQueued-AsynchronousFlowProcessingStrategy

Page 13: Using seda in mule

In my next slide I will bring some other techniques in Mule implementation .Hope you have enjoyed this simpler version.

Page 14: Using seda in mule