blob: ff5048c19cc257e3aea204dc47fcf3e13d60c20b [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>2.1 - Application Architecture &mdash; Apache MINA</title>
<link href="/assets/css/common.css" rel="stylesheet" type="text/css"/>
<link href="/assets/css/mina.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<script src="https://www.apachecon.com/event-images/snippet.js"></script>
<div id="container">
<div id="header">
<div id="subProjectsNavBar">
<a href="/">
Apache MINA Project
</a>
&nbsp;|&nbsp;
<a href="/mina-project/">
<strong>MINA</strong>
</a>
&nbsp;|&nbsp;
<a href="/asyncweb-project/">
AsyncWeb
</a>
&nbsp;|&nbsp;
<a href="/ftpserver-project/">
FtpServer
</a>
&nbsp;|&nbsp;
<a href="/sshd-project/">
SSHD
</a>
&nbsp;|&nbsp;
<a href="/vysper-project/">
Vysper
</a>
</div>
</div>
<div id="content">
<div id="leftColumn">
<div id="navigation">
<a class="acevent" data-format="wide" data-width="170"></a>
<h5>Social Networks</h5>
<ul>
<li><a href="https://fosstodon.org/@apachemina">Apache MINA Mastodon</a></li>
</ul>
<h5>Latest Downloads</h5>
<ul>
<li><a href="/mina-project/downloads_2_0.html">Mina 2.0.25</a></li>
<li><a href="/mina-project/downloads_2_1.html">Mina 2.1.8</a></li>
<li><a href="/mina-project/downloads_2_2.html">Mina 2.2.3</a></li>
<li><a href="/mina-project/downloads_old.html">Mina old versions</a></li>
</ul>
<h5>Documentation</h5>
<ul>
<li><a href="/mina-project/documentation.html" class="external-link" rel="nofollow">Base documentation</a></li>
<li><a href="/mina-project/userguide/user-guide-toc.html" class="external-link" rel="nofollow">User guide</a></li>
<li><a href="/mina-project/2.2-vs-2.1.html" class="external-link" rel="nofollow">2.2 vs 2.1</a></li>
<li><a href="/mina-project/2.1-vs-2.0.html" class="external-link" rel="nofollow">2.1 vs 2.0</a></li>
<li><a href="/mina-project/features.html" class="external-link" rel="nofollow">Features</a></li>
<li><a href="/mina-project/road-map.html" class="external-link" rel="nofollow">Road Map</a></li>
<li><a href="/mina-project/quick-start-guide.html" class="external-link" rel="nofollow">Quick Start Guide</a></li>
<li><a href="/mina-project/faq.html" class="external-link" rel="nofollow">FAQ</a></li>
</ul>
<h5>Resources</h5>
<ul>
<li><a href="/mina-project/mailing-lists.html" class="external-link" rel="nofollow">Mailing lists &amp; IRC</a></li>
<li><a href="/mina-project/issue-tracking.html" class="external-link" rel="nofollow">Issue tracking</a></li>
<li><a href="/mina-project/sources.html" class="external-link" rel="nofollow">Sources</a></li>
<li><a href="/mina-project/gen-docs/latest-2.0/apidocs/index.html" class="external-link" rel="nofollow">API Javadoc 2.0.25</a></li>
<li><a href="/mina-project/gen-docs/latest-2.1/apidocs/index.html" class="external-link" rel="nofollow">API Javadoc 2.1.8</a></li>
<li><a href="/mina-project/gen-docs/latest-2.2/apidocs/index.html" class="external-link" rel="nofollow">API Javadoc 2.2.3</a></li>
<li><a href="/mina-project/gen-docs/latest-2.0/xref/index.html" class="external-link" rel="nofollow">API xref 2.0.25</a></li>
<li><a href="/mina-project/gen-docs/latest-2.1/xref/index.html" class="external-link" rel="nofollow">API xref 2.1.8</a></li>
<li><a href="/mina-project/gen-docs/latest-2.2/xref/index.html" class="external-link" rel="nofollow">API xref 2.2.3</a></li>
<li><a href="/mina-project/performances.html" class="external-link" rel="nofollow">Performances</a></li>
<li><a href="/mina-project/testimonials.html" class="external-link" rel="nofollow">Testimonials</a></li>
<li><a href="/mina-project/conferences.html" class="external-link" rel="nofollow">Conferences</a></li>
<li><a href="/mina-project/developer-guide.html" class="external-link" rel="nofollow">Developers Guide</a></li>
<li><a href="/mina-project/related-projects.html" class="external-link" rel="nofollow">Related Projects</a></li>
<li><a href="https://people.apache.org/~vgritsenko/stats/projects/mina.html" class="external-link" rel="nofollow">Statistics</a></li>
</ul>
<h5>Community</h5>
<ul>
<li><a href="https://www.apache.org/foundation/contributing.html" class="external-link" rel="nofollow">Contributing</a></li>
<li><a href="/contributors.html" class="external-link" rel="nofollow">Team</a></li>
<li><a href="/special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
<li><a href="https://www.apache.org/security/" class="external-link" rel="nofollow">Security</a></li>
</ul>
<h5>About Apache</h5>
<ul>
<li><a href="https://www.apache.org" class="external-link" rel="nofollow">Apache main site</a></li>
<li><a href="https://www.apache.org/licenses/" class="external-link" rel="nofollow">License</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html" title="The ASF sponsorship program" class="external-link" rel="nofollow">Sponsorship program</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</a></li>
</ul>
<h3><a name="Navigation-Upcoming"></a>Upcoming</h3>
<ul>
<li>No event</li>
</ul>
</div>
</div>
<div id="rightColumn">
<div class="nav">
<div class="nav_prev">
<a href="ch2-basics.html">Chapter 2 - Basics</a>
</div>
<div class="nav_up">
<a href="ch2-basics.html">Chapter 2 - Basics</a>
</div>
<div class="nav_next">
<a href="ch2.2-sample-tcp-server.html">2.2 - Sample TCP Server</a>
</div>
<div class="clearfix"></div>
</div>
<ul>
<li><a href="ch2.1.1-server-architecture.html">2.1.1 - Server Architecture</a></li>
<li><a href="ch2.1.2-client-architecture.html">2.1.2 - Client Architecture</a></li>
</ul>
<h1 id="21----mina-based-application-architecture">2.1 - MINA based Application Architecture</h1>
<p>It&rsquo;s the question most asked: &lsquo;How does a <strong>MINA</strong> based application look like&rsquo;? In this article lets see what&rsquo;s the architecture of MINA based application. Have tried to gather the information from presentations based on <strong>MINA</strong>.</p>
<p>A Bird&rsquo;s Eye View:</p>
<p><img src="/assets/img/mina/apparch_small.png" alt=""></p>
<p>Here, we can see that <strong>MINA</strong> is the glue between your application (be it a client or a server) and the underlying network layer, which can be based on TCP, UDP, in-VM communication or even a RS-232C serial protocol for a client.</p>
<p>You just have to design your application on top of MINA without having to handle all the complexity of the network layer.</p>
<p>Lets take a deeper dive into the details now. The following image shows a bit more the internal of <strong>MINA</strong>, and what are each of the <strong>MINA</strong> components doing:</p>
<p><img src="/assets/img/mina/mina_app_arch.png" alt=""></p>
<p>(The image is from Emmanuel L&eacute;charny presentation <a href="/assets/pdfs/Mina_in_real_life_ASEU-2009.pdf">MINA in real life (ApacheCon EU 2009)</a>)</p>
<p>Broadly, MINA based applications are divided into 3 layers</p>
<ul>
<li>I/O Service - Performs actual I/O</li>
<li>I/O Filter Chain - Filters/Transforms bytes into desired Data Structures and vice-versa</li>
<li>I/O Handler - Here resides the actual business logic</li>
</ul>
<p>So, in order to create a MINA based Application, you have to:</p>
<ol>
<li>Create an I/O service - Choose from already available Services (<em>Acceptor</em>) or create your own</li>
<li>Create a Filter Chain - Choose from already existing Filters or create a custom Filter for transforming request/response</li>
<li>Create an I/O Handler - Write business logic, on handling different messages</li>
</ol>
<p>This is pretty much it.</p>
<p>You can get a bit deeper by reading those two pages:</p>
<ul>
<li><a href="ch2.1.1-server-architecture.html">2.1.1 - Server Architecture</a></li>
<li><a href="ch2.1.2-client-architecture.html">2.1.2 - Client Architecture</a></li>
</ul>
<p>Of course, <strong>MINA</strong> offers more than just that, and you will probably have to take care of many other aspects, like the messages encoding/decoding, the network configuration how to scale up, etc&hellip; We will have a further look at those aspects in the next chapters.</p>
<div class="nav">
<div class="nav_prev">
<a href="ch2-basics.html">Chapter 2 - Basics</a>
</div>
<div class="nav_up">
<a href="ch2-basics.html">Chapter 2 - Basics</a>
</div>
<div class="nav_next">
<a href="ch2.2-sample-tcp-server.html">2.2 - Sample TCP Server</a>
</div>
<div class="clearfix"></div>
</div>
</div>
<div id="endContent"></div>
</div>
<div id="footer">
&copy; 2003-2024, <a href="https://www.apache.org">The Apache Software Foundation</a> - <a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy Policy</a><br />
Apache MINA, MINA, Apache Vysper, Vysper, Apache SSHd, SSHd, Apache FtpServer, FtpServer, Apache AsyncWeb, AsyncWeb,
Apache, the Apache feather logo, and the Apache Mina project logos are trademarks of The Apache Software Foundation.
</div>
</div>
</body>
</html>