<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dunith Dhanushka&#039;s Weblog</title>
	<atom:link href="http://dunithd.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dunithd.wordpress.com</link>
	<description>Byte level publication of my home grown tech tips...</description>
	<lastBuildDate>Thu, 26 Jan 2012 13:09:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dunithd.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/2ae8febb16cbcaa58ada0924dac88c9a?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Dunith Dhanushka&#039;s Weblog</title>
		<link>http://dunithd.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dunithd.wordpress.com/osd.xml" title="Dunith Dhanushka&#039;s Weblog" />
	<atom:link rel='hub' href='http://dunithd.wordpress.com/?pushpress=hub'/>
		<item>
		<title>A year of blogging</title>
		<link>http://dunithd.wordpress.com/2010/10/19/a-year-of-blogging/</link>
		<comments>http://dunithd.wordpress.com/2010/10/19/a-year-of-blogging/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 20:19:12 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=133</guid>
		<description><![CDATA[My dear readers, it has been a year since I have been blogging here! Last year I started this blog while I was an undergraduate student. I used to play around with some Java code snippets in my free time and blog my recipes here. Those &#8216;home-grown&#8217; recipes are results of many trial and error [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=133&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_138" class="wp-caption aligncenter" style="width: 260px"><a href="http://dunithd.files.wordpress.com/2010/10/birthday-cake-clipart-for-powerpoint.gif"><img class="size-full wp-image-138" title="birthday cake clipart for powerpoint" src="http://dunithd.files.wordpress.com/2010/10/birthday-cake-clipart-for-powerpoint.gif?w=632" alt=""   /></a><p class="wp-caption-text">A year of blogging</p></div>
<p>My dear readers, it has been a year since I have been blogging here!</p>
<p>Last year I started this blog while I was an undergraduate student. I used to play around with some Java code snippets in my free time and blog my recipes here. Those &#8216;home-grown&#8217; recipes are results of many trial and error experiments so that they turns out to be amazing.</p>
<p>After finishing my degree I had to seek for a job. After getting a job, my &#8216;Quality Time&#8217; was limited. Quality time is the time I used to hack open source projects,  analyse their architecture and try to build new things from existing interesting projects.</p>
<p>Although I lost my time for blogging, I tried to do at least one post per month.</p>
<p>So far my blog received 6929 views onsite( According to WordPress stats) and I&#8217;m satisfied with what I&#8217;ve shared with community and I&#8217;ve got back in return.</p>
<p>In the next year, I&#8217;m planning to increase the &#8216;post density&#8217; of my blog. That simply means number of posts per month. my target is 10 posts per month.  I know that this is very ambitious goal but I am ready to take the challenge!</p>
<p><strong>Finally I must say thank you for all the people who visited this blog, read it and commented on it.</strong></p>
<p>and don&#8217;t forget, stay tuned for more home grown tech tips and hacks! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>regards,<br />
Dunith Dhanushka (dunithd)</p><br />Filed under: <a href='http://dunithd.wordpress.com/category/misc/'>Misc</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=133&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2010/10/19/a-year-of-blogging/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2010/10/birthday-cake-clipart-for-powerpoint.gif" medium="image">
			<media:title type="html">birthday cake clipart for powerpoint</media:title>
		</media:content>
	</item>
		<item>
		<title>Voldemort sink implementation for Cloudera Flume</title>
		<link>http://dunithd.wordpress.com/2010/10/03/voldemort-sink-implementation-for-cloudera-flume/</link>
		<comments>http://dunithd.wordpress.com/2010/10/03/voldemort-sink-implementation-for-cloudera-flume/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 17:18:10 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Cloudera Flume]]></category>
		<category><![CDATA[Voldemort]]></category>
		<category><![CDATA[Cloudera]]></category>
		<category><![CDATA[Flume]]></category>
		<category><![CDATA[voldemort]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=127</guid>
		<description><![CDATA[Recently I implemented a Flume sink which uses Voldemort as its data store. Now it is hosted in GitHub and please feel free to fork it and experiment with it. But before that I&#8217;ll give you some insight into Flume and Voldemort so that it&#8217;ll help you to get a good picture about both of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=127&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I implemented a Flume sink which uses Voldemort as its data store. Now it is hosted in <a href="http://github.com/dunithd/flume-voldemort-plugin" target="_blank">GitHub</a> and please feel free to fork it and experiment with it. But before that I&#8217;ll give you some insight into Flume and Voldemort so that it&#8217;ll help you to get a good picture about both of them.</p>
<h3>What is Flume?</h3>
<p>Flume is a distributed system that gets your logs from their source and aggregates them to where you want to process them . The primary use case is as a logging system that gathers a set of log files on every machine in a cluster and aggregates them to a centralized persistent store such as HDFS. </p>
<p>Flume is an open source project from <a title="www.cloudera.com" href="www.cloudera.com" target="_blank">Cloudera</a> and it is licensed under Apache license v2.0. Cloudera provides enterprise support for the Apache Hadoop project and it&#8217;s sub projects such as Pig, Hive, HBase and ZooKeeper. Their distribution is named as “Cloudera’s Distribution for Hadoop(CDH)” and it has got several sub components from Cloudera including Flume, Sqoop and Hue.</p>
<p>Before proceed with rest of the article,  I recommend to yo visit <a title="www.cloudera.com" href="www.cloudera.com" target="_blank">http://www.cloudera.com</a> and have a better picture about Flume and its architecture.</p>
<h3>Why Flume?</h3>
<p>Flume is not limited to collect logs from distributed systems, but it is capable of performing other use cases such as </p>
<ul>
<li>Collecting readings 	from array of sensors </li>
<li>Collecting impressions 	from custom apps for an ad network </li>
<li>Collecting readings 	from network devices in order to monitor their performance.</li>
</ul>
<p>Flume is targeted to preserve the reliability, scalability, manageability and extensibility while it serves maximum number of clients with higher QoS.</p>
<h3><span style="font-family:Arial, sans-serif;">Flume is easy to extend</span></h3>
<p>Flume was awesome to me because it is very easy to extend. The source and sink architecture is flexible and provides simpler APIs.</p>
<p><strong>What is a Source?</strong><br />
Source in the sense, a data provider that produces event data and send them downstream. Flume supports reading from many data sources such as standard console(stdin), syslog, text file and even tailing a file. Sources are the origin of events.</p>
<p><strong>What is a Sink?</strong></p>
<p>Sinks are the destinations of events. They travel downward from sources to sinks. There are many possible destinations for events — to local disk, to HDFS, to the console, or forwarding across the network. You use the sink abstractions as an interface for forwarding events to any of these destinations.</p>
<p>The beauty of the Flume is you can implement your  own sink or source and plug it to the core very easily. Plugging a new source/sink it to Flume core is just a matter of editing some configuration files.</p>
<p>because of this cool feature, I started thinking about adding <a href="http://project-voldemort.com" target="_blank">Voldemort</a> as a Flume event sink.</p>
<h3>What is Voldemort?</h3>
<p>I&#8217;ve blogged about Voldemort in my <a title="Read it here" href="http://dunithd.wordpress.com/2010/07/16/implementing-a-persistent-fifo-queue-in-java-using-voldemort/" target="_blank">previous</a> blog post. You can read more details about Voldemort there. But for the sake of clarity I&#8217;ll introduce you Voldemort again.</p>
<p>Voldemort is an open source distributed key-value storage which is implemented by <a href="http://sna-projects.com/blog/" target="_blank">SNA</a> team at <a href="http://www.linkedin.com" target="_blank">LinkedIn</a>. It realised the <a href="http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html" target="_blank">Amazon&#8217;s Dynamo paper</a> which has been a great milestone in implementing key-value storage systems.</p>
<p>One of most loveable feature of Voldemort is its rich documentation compared to other competitor key-value storage systems. Apart from that it has been backed by a strong community of developers so that getting help and support  can be easily done.</p>
<h3>Why Voldemort?</h3>
<p>Voldemort is a distributed, fault tolerant and highly scalable key-value storage. So it is well suited for  enterprise level operations.</p>
<p><a name="__DdeLink__16_1473065946"></a>Analysing logs in enterprise applications is a challenging task. Logs are produced by multiple computers so that amount of data required to analyse is comparatively large. Until logs are processed, they needs to be stored in a reliable, fault tolerant and scalable storage medium. So Voldemort would fit into this situation without any doubts.</p>
<h3>Voldemort sink for Flume</h3>
<p>Now we are on our business. I think the prelude is somewhat lengthy one <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Voldemort sink for Flume is supposed to store events which are received from different Flume sources into Voldemort. It looks like this is pretty much straightforward task initially. But there  were several issues required more consideration.</p>
<h3>Design considerations for Voldemort sink</h3>
<p>There were several design considerations had to take place when I was started designing the sink. I must specially thanks you for <a href="http://www.linkedin.com/in/rsumbaly" target="_blank">Roshan Sumbaly</a> from LinkedIn for his ideas. So below are the design decisions I had to consider</p>
<p><strong>Key generation strategy and granularity of the key space.</strong></p>
<p>I already mentioned that Voldemort is a key-value storage system. So any value being stored there must have a unique key assigned to it. </p>
<p>Regarding this Flume sink, same situation applied. When sink receives an event from a source, we have to store this event in Voldemort. But before that, a unique key must be generated and assigned to that event value. There are several ways to generate a unique Id for a key such as random numbers, UUID generators and time stamps.</p>
<p>But the biggest problem we have to face here is when retrieving the stored log entries(or events) from Voldemort, how can we exactly specify what entry we need back? We can retrieve a stored value in Voldemort by performing GET operation with key of the stored value. Since we are not keeping track of the generated key set inside the sink it is impossible to retrieve the stored entries back. </p>
<p>Using time stamps  as keys seems to be a solution to this problem. If we use “yyyyMMddhhmmS” as the time stamp format, an example key might look like this </p>
<p> <strong>201010031030345</strong></p>
<p><strong>2010 &lt;- </strong>Year, <strong>10 &lt;- </strong>month, <strong>03</strong> &lt;- day, <strong>10</strong> &lt;- hour, <strong>30</strong> &lt;- minute, <strong>345</strong> &lt;- mili seconds</p>
<p>But even if we use this strategy we have to face a problem. Voldemort doesnt support for range query operations so that  if we need to retrieve an entry inside Voldemort, it is mandatory to know the exact time stamp  when entry is inserted. Because that time stamp is the key for that entry.</p>
<p>At this stage Roshan told me that bucketing the keys using the time stamp would be a better solution. That means we can append log entries/events for the  same key. Entries can be collected within several granularity levels such as per day, per hour and per minute. This granularity is configurable at sink&#8217;s construction time  so that users have to specify the granularity level as “DAY”, “HOUR” or “MINUTE”. </p>
<p>Say for example the current time stamp is 2010/10/03 10:30. So the generated key will be like below under different granularity levels.</p>
<ul>
<li>If 	“DAY” is specified =&gt; key will be 20101003</li>
<li>If 	“HOUR” is specified =&gt; key will be 2010100310</li>
<li>If 	“MINUTE” is specified =&gt; key will be 201010031030</li>
</ul>
<p>When “DAY” is specified, all the log entries will be appended to key “20101003”. When “HOUR” is specified all entries will be appended to  “2010100310”  and  so on. Keys will be changed once the day, hour or minute changes in the day. To delimit the log entries, each entry is delimited with a pipe “|” character so that once you retrieve the entries it is just a matter of splitting the value String to original log lines.</p>
<p><strong>Using JSON as the key serialization format</strong></p>
<p>JSON is obviously the most efficient serialization format compared to Strings. So its recommended to configure the Voldemort store with JSON as key serialization format. Value can be in any prefered format. </p>
<h3>Installing and configuring Voldemort sink for Flume</h3>
<p>You can find the detailed installation guide at <a href="http://github.com/dunithd/flume-voldemort-plugin">GitHub</a>.</p>
<h3>Coming up next&#8230;</h3>
<p>I&#8217;m also working on the Voldemort source and planning to release it soon. Before that I&#8217;d like to know your feedbacks on this. So feel free to fork the project and hack it!</p>
<p>Happy hacking! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p><br />Filed under: <a href='http://dunithd.wordpress.com/category/cloudera-flume/'>Cloudera Flume</a>, <a href='http://dunithd.wordpress.com/category/voldemort/'>Voldemort</a> Tagged: <a href='http://dunithd.wordpress.com/tag/cloudera/'>Cloudera</a>, <a href='http://dunithd.wordpress.com/tag/flume/'>Flume</a>, <a href='http://dunithd.wordpress.com/tag/voldemort-2/'>voldemort</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=127&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2010/10/03/voldemort-sink-implementation-for-cloudera-flume/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>
	</item>
		<item>
		<title>Implementing a persistent FIFO queue in Java using Voldemort</title>
		<link>http://dunithd.wordpress.com/2010/07/16/implementing-a-persistent-fifo-queue-in-java-using-voldemort/</link>
		<comments>http://dunithd.wordpress.com/2010/07/16/implementing-a-persistent-fifo-queue-in-java-using-voldemort/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 16:34:43 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Voldemort]]></category>
		<category><![CDATA[data structures]]></category>
		<category><![CDATA[distributed databases]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[voldemort]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=111</guid>
		<description><![CDATA[Background Recently I joined a company which provides real-time stock market information to its clients through a proprietary stock price dissemination server. Initially server connects to stock exchanges and listens for incoming market data frames. Once a frame has been read from the socket, it will be placed in a In-memory queue so that it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=111&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>
<p style="text-align:center;"><a href="http://dunithd.files.wordpress.com/2010/07/voldermortimage.jpg"><img class="size-full wp-image-120 aligncenter" title="Voldermortimage" src="http://dunithd.files.wordpress.com/2010/07/voldermortimage.jpg?w=632" alt=""   /></a></p>
</h3>
<h3>Background</h3>
<p>Recently I joined a company which provides real-time stock market information to its clients through a proprietary stock price dissemination server. Initially server connects to stock exchanges and listens for incoming market data frames. Once a frame has been read from the socket, it will be placed in a In-memory queue so that it can be used for further processing.<br />
Problem arose with this approach is Queue is getting filled rapidly with frames and theres no control over its upper limit. Since the queue is a in-memory data structure, its rapid growth affects the overall server  performance.</p>
<p>I was assigned the task of designing a new data structure to address this problem.</p>
<h3>Queue design requirements</h3>
<p>Holding a large data set inside the memory is inefficient and risky. All of a sudden if something went wrong in the server, whole data set will be vanished in to thin air in a second. So there must be a mechanism to periodically write  in-memory snapshots to some persistent storage.</p>
<p>When queue is growing, it would be better to distribute the queue content across multiple servers. Simply put, there should be a way to distribute the queue&#8217;s  load across a cluster. For that purpose a distributed database is an ideal solution.</p>
<p>Everything above is worthless if performance of the in-memory data structure is lagging behind the business need.  It would be better if time complexity of read/write operations against the queue is O(1). That means, the time taken to perform a read/write operation on the queue is always a constant and does not depend on the number of items in the queue.</p>
<p>By considering above factors, I came across a decision to find a replacement for the in-memory queue with something meets following requirements.</p>
<p>1.  New data structure must be able to provide the FIFO facility as same as our good old one.</p>
<p>2.  It should be good in performance and time complexity of read/write operations should be O(1).</p>
<p>3.  It might store data in memory, but there should be a way to write that data into the disk  periodically.</p>
<p>4.  It should be able to distribute its storage load across a cluster.</p>
<h3>Distributed databases and Voldemort</h3>
<p>In these days relational databases are eventually walking towards their twilight age. Most of the web applications suffer from the pain of scalability. Mean while paradigms like &#8216;NoSQL&#8217; have began to roll out in the Internet arena.</p>
<p>Traditional relational database management systems fail when they try to scale horizontally. Specially they take very bad face when it comes to the replication. Because of that distributed databases are gradually taking control over relational databases in heavily loaded web applications like Twitter, Facebook and LinkedIn.</p>
<p>Voldemort in a sense is a distributed key-value storage system. Unlike traditional relational databases it has no schema or complex querying mechanism. But it is very simple to use. In order to get to know what exactly it is, following text would helpful. It&#8217;s been taken from Voldemort website.</p>
<blockquote><p>Voldemort is not a relational database, it does not attempt to satisfy arbitrary relations while satisfying ACID properties. Nor is it an object database that attempts to transparently map object reference graphs. Nor does it introduce a new abstraction such as document-orientation. It is basically just a big, distributed, persistent, fault-tolerant hash table. For applications that can use an O/R mapper like active-record or hibernate this will provide horizontal scalability and much higher availability but at great loss of convenience. For large applications under Internet-type scalability pressure, a system may likely consists of a number of functionally partitioned services or APIs, which may manage storage resources across multiple data centers using storage systems which may themselves be horizontally partitioned.</p></blockquote>
<p><strong>How does Voldemort store data?</strong></p>
<p>As I mentioned earlier, Voldemort is a simple key value storage system. Data can be saved and retrieved back calling simple get() and put() operations. All read/write operations are in O(1) time complexity and having excellent single node performance compared to other relational databases.</p>
<h3>I need to access it sequentially, not by using a key&#8230;</h3>
<p>I made a little detour from our initial discussion. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Sorry about that&#8230;</p>
<p>Considering the drawbacks of the in-memory FIFO queue, I started to design a new data structure which stores data in memory but periodically writes them to persistent storage. In addition to that data structure is capable of distributing its load across a cluster.</p>
<p>Since our price server is written in Java and Voldemort is also in Java, I started to implement a thin  Java wrapper  for Voldemort client which behaves exactly like a FIFO queue but persistence is done through Voldemort.</p>
<p>The major problem I had to face here was Voldemort is a key-value store and all data entries being stored on it should have a unique key assigned to it. Simply speaking, if you have something to save in Voldemort, you must provide a unique key for that. But all I need here is a simple FIFO queue which is capable of inserting new entries and getting the firstly inserted entry(or head of the queue). I don&#8217;t need to assign any keys for the values which are being inserted into the queue and users of the queue should not aware of those keys.</p>
<p>So I need to find a way to automatically assign unique keys to the entries before saving them in to Voldemort. This is because I don&#8217;t want to assign queue users an extra responsibility of generating unique ids for the entries.</p>
<p>UUID is a perfect solution for this context. UUID is a universally unique identifier and by using a UUID generator inside the queue, I could assign unique keys for the entries. It saved my day finally <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This strategy is illustrated below</p>
<p><a href="http://dunithd.files.wordpress.com/2010/07/internal.jpg"><img class="aligncenter size-full wp-image-112" title="Queue Internal" src="http://dunithd.files.wordpress.com/2010/07/internal.jpg?w=632&#038;h=410" alt="" width="632" height="410" /></a></p>
<h3>Case : Implementing a persistent FIFO Queue by wrapping Voldemort client</h3>
<h4>Step 1: Write a simple Voldemort client</h4>
<p>First step is to crate an interface to the Voldemort engine. This can be done through Voldemort client API. Using this client, queue can perform storage operations like saving and retrieving entries.</p>
<p>Below is the complete source code for my Voldemort client.</p>
<p><pre class="brush: java;">
package com.dunithd;

import voldemort.client.ClientConfig;
import voldemort.client.SocketStoreClientFactory;
import voldemort.client.StoreClient;
import voldemort.client.StoreClientFactory;
import voldemort.versioning.Versioned;

/**
 * Actual Voldemort client that does the storage operations
 * &lt;/p&gt;
 * Author: &lt;a href=&quot;http://dunithd.wordpress.com&quot;&gt;Dunith Dhanushka&lt;/a&gt;, Date: Jul 2, 2010
 */
public class VoldemortClient {

    private String host = &quot;tcp://localhost:6666&quot;;
    private StoreClientFactory factory;
    private StoreClient client;

    public VoldemortClient() {
        this.factory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(host));
        this.client = factory.getStoreClient(&quot;test&quot;);
    }

    public void put(String key, Object value) throws NullPointerException {
        if(key == null) {
            throw new NullPointerException();
        } else {
            client.put(key,value);
        }
    }

    public Object get(String key) {
        Versioned value = client.get(key);
        return value.getValue();
    }

}

</pre></p>
<p>This client is very simple and has only two operations.</p>
<h4>Step 2: Write the Queue implementation</h4>
<p>This is the actual job you have to perform.</p>
<p><pre class="brush: java;">
package com.dunithd;

import java.util.LinkedList;
import java.util.UUID;

/**
 * Wraps a LinkedList and creates a FIFO queue.
 * &lt;p/&gt;
 * Author: &lt;a href=&quot;http://dunithd.wordpress.com&quot;&gt;Dunith Dhanushka&lt;/a&gt;, Date: Jul 2, 2010
 */
public class Queue {

    private LinkedList keys;
    private UUID key;

    private VoldemortClient map;

    public Queue() {
        keys = new LinkedList&lt;UUID&gt;();
        map = new VoldemortClient();
    }

    public void put(Object value) throws NullPointerException {
        if(value == null) {
            throw new NullPointerException();
        }
        //first, generate a random key for the given value
        key = UUID.randomUUID();
        keys.add(key);  //add the key to the LinkedList

        map.put(key.toString(),value); //finally put an entry to the Hashtable
    }

    public Object take() {
        UUID headKey = (UUID)keys.remove(0);    //retrieve the first key entry
        //get the associated entry related to the first key
        Object entry = map.get(headKey.toString());

        return entry;
    }

}

</pre></p>
<p>Again, this is a simple class which is having two operations, put() and take(). To store the keys of the entries which are being stored, I used a Linked List.</p>
<p>When you need to insert an entry(&lt;V&gt;) to the queue, following activities will be performed.</p>
<p>1.  A random unique identifier is generated using UUID class. This identifier is the key(&lt;K&gt;) for that entry.</p>
<p>2.  Generated key is inserted to the keys Linked List. In this case, key will be added to as the last item of the Linked List.</p>
<p>3.  Save the entry into Voldemort engine as a key value pair of &lt;K,V&gt; where K is the generated key and V is the value being saved. Here the save operation will done through our Voldemort client.</p>
<p>Above set of activities are included in the put() operation of the Queue class.</p>
<p>When retrieving the head of the queue, following activities will be performed.</p>
<p>1.  Retrieve the key of the entry which has been inserted first most. This can be done by calling Linked List&#8217;s getFirst() method so that it will return the first item of the key list.</p>
<p>2.  Using this key, retrieve the corresponding value by calling Voldemort client&#8217;s get() method.</p>
<p>Above set of activities are included in the take() operation of the Queue class.</p>
<p>Note that you can extend this Queue class to meet your business requirements and take() and put() operations are just work horses.</p>
<h4>Step 3: Use the Queue class as your wish</h4>
<p>Hardest part is over. Now you can use the Queue to meet your business needs.</p>
<p><pre class="brush: java;">
package com.dunithd;

/**
 * Main class to test our Voldemort based FIFO queue
 * &lt;p/&gt;
 * Author: &lt;a href=&quot;http://dunithd.wordpress.com&quot;&gt;Dunith Dhanushka&lt;/a&gt;, Date: Jul 2, 2010
 */
public class Main {

    public static void main(String[] args) {
        Queue queue = new Queue();

        queue.put(&quot;Monday&quot;);
        queue.put(&quot;Tuesday&quot;);
        queue.put(&quot;Wednesday&quot;);
        queue.put(&quot;Thursday&quot;);
        queue.put(&quot;Friday&quot;);

        for (int i = 0; i &lt; 5; i++) {
            System.out.println(queue.take().toString());
        }

    }
}
</pre></p>
<h3>An improved design for the Queue</h3>
<p>Queue design can be elaborated by decoupling the storage engine from the Queue. So you don&#8217;t have to limit only to Voldemort. You can try other key-value storage systems like Redis, MongoDb and Apache Cassandra as the storage of your queue. Although Redis and MongoDb is not implemented in Java, they do have APIs for Java.</p>
<p>Below is the decoupled architecture for the Queue.</p>
<p><a href="http://dunithd.files.wordpress.com/2010/07/queue_design.jpeg"><img class="aligncenter size-full wp-image-113" title="Queue_design" src="http://dunithd.files.wordpress.com/2010/07/queue_design.jpeg?w=632&#038;h=247" alt="" width="632" height="247" /></a></p><br />Filed under: <a href='http://dunithd.wordpress.com/category/voldemort/'>Voldemort</a> Tagged: <a href='http://dunithd.wordpress.com/tag/data-structures/'>data structures</a>, <a href='http://dunithd.wordpress.com/tag/distributed-databases/'>distributed databases</a>, <a href='http://dunithd.wordpress.com/tag/java/'>java</a>, <a href='http://dunithd.wordpress.com/tag/voldemort-2/'>voldemort</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=111&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2010/07/16/implementing-a-persistent-fifo-queue-in-java-using-voldemort/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2010/07/voldermortimage.jpg" medium="image">
			<media:title type="html">Voldermortimage</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2010/07/internal.jpg" medium="image">
			<media:title type="html">Queue Internal</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2010/07/queue_design.jpeg" medium="image">
			<media:title type="html">Queue_design</media:title>
		</media:content>
	</item>
		<item>
		<title>Real time web: Making web real time with push technology</title>
		<link>http://dunithd.wordpress.com/2010/05/05/real-time-web-making-web-real-time-with-push-technology/</link>
		<comments>http://dunithd.wordpress.com/2010/05/05/real-time-web-making-web-real-time-with-push-technology/#comments</comments>
		<pubDate>Wed, 05 May 2010 16:52:34 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Real-time web]]></category>
		<category><![CDATA[comet]]></category>
		<category><![CDATA[long polling]]></category>
		<category><![CDATA[pubsubhubbub]]></category>
		<category><![CDATA[real-time web]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[web hooks]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=105</guid>
		<description><![CDATA[Annoying son and the angry father A boy tells his father “Hey dad! I want to go the zoo right now!” Then his father takes him to the car and start driving to the zoo. The boy is so excited about the tour and eager to get to the zoo immediately. So, while they are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=105&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>
Annoying son and the angry father</h2>
<p>A boy tells his father “Hey dad! I want to go the zoo right now!”  Then his father takes him to the car and start driving to the zoo.  The boy is so excited about the tour and eager to get to the zoo immediately. So, while they are travelling boy repeatedly asks his father “Are we there yet?” Then father replied “No”</p>
<p>Boy: Are we there yet?<br />
Dad: No</p>
<p>Boy: Are we there yet?<br />
Dad: No</p>
<p>Boy: Are we there yet?<br />
Dad: No</p>
<p>Boy is too annoying and angry father tells to the boy “Will you stop asking the same question? Otherwise I’ll get back you to home!”</p>
<h2>World Wide Web in the good old days</h2>
<p>If you carefully read the above story, you can find a similarity between that story and the traditional web. This is exactly analogous to a case like RSS reader repeatedly polling a web server for new content. Annoying boy is RSS reader and the angry father is web server in that case.</p>
<p>This is the nature of the web from its beginning. Since web is based on the client-server architecture, every time client has to initiate the request and server has to respond. Client exactly doesn’t know when new content arrives from the server so that client has to poll the server periodically.  That’s why your email client repeatedly polls the mail server for new email. That’s why your news reader repeatedly polls the news server for latest news.</p>
<p>This “Pull model” makes so many problems when it comes to the bandwidth consumption. Continuous polling makes higher traffic on the networks and it causes the server hardware overloaded. Because of these issues, several attempts have came up during the last few years.</p>
<h2>What is real-time web?</h2>
<p>“The Real-Time Web is a paradigm based on pushing information to users as soon as it&#8217;s available &#8211; instead of requiring that they or their software check a source periodically for updates. It can be enabled in many different ways and can require a different technical architecture. It&#8217;s being implemented in social networking, search, news and elsewhere &#8211; making those experiences more like Instant Messaging and facilitating unpredictable innovations. Early benefits include increased user engagement (&#8220;flow&#8221;) and decreased server loads, but these are early days. Real-time information delivery will likely become ubiquitous, a requirement for almost any website or service.” – Read Write Web, 2009</p>
<p>Actually speaking, social networks put the first steps of making web real time. If you are Facebook or Twitter fanatic, you may have experienced their real time news feeds and status updates. They are more likely to Instant Messaging.  Once your friend tags you in a photograph, you will be immediately notified by Facebook. Whenever a new Tweet arrives, you will be notified by Twitter. Likewise social networks offer their users a real time experiences day by day.</p>
<h2>How to make web real time?</h2>
<p>As I mentioned earlier there are several attempts to make the traditional web real time. Some of them are very straightforward in their nature while some of them are technically challenging. Below I’m going to describe several approaches to make web real time.</p>
<h3>1. Web hooks</h3>
<p>The concept of a WebHook is simple. A WebHook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST.</p>
<p>A web application implementing WebHooks will POST a message to a URL when certain things happen. When a web application enables users to register their own URLs, the users can then extend, customize, and integrate that application with their own custom extensions or even with other applications around the web. For the user, WebHooks are a way to receive valuable information when it happens, rather than continually polling for that data and receiving nothing valuable most of the time.</p>
<p>Read more about web hooks <a href="http://wiki.webhooks.org/">here</a></p>
<h3>2. HTTP server push (HTTP Streaming)</h3>
<p>HTTP streaming is yet another elegant way of getting content as soon as they are published. Here, web server sends or pushes data to the web browser which is opposite to the traditional client-server architecture.</p>
<p>In this mechanism, web server doesn’t terminate a connection after response data has been served to a client. The web server leaves the connection open such that if an event is received, it can immediately be sent to one or multiple clients. Otherwise the data would have to be queued until the client&#8217;s next request is received. Several web servers offer this functionality CGI (Common Gateway Interface)</p>
<p>Read more about HTTP server push <a href="http://ejohn.org/blog/streaming-http-server-push/">here</a></p>
<h3>3. XMPP</h3>
<p>XMPP is a protocol that can be used to send instant messages. Its underlying technology is XML stanzas. By using XMPP, server can push new content to its client including browsers, desktop applications and mobile devices as well.</p>
<p>Read more about XMPP <a href="http://xmpp.org/">here</a></p>
<h3>4. Comet</h3>
<p>Comet is a common term that describes a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it. Comet has various methods to achieve this web model.</p>
<p>Hidden iFrames, Ajax with long polling and XMLHttpRequest are some of the methodologies that are adhere to this Comet web application model.</p>
<p>Read more about Comet <a href="http://en.wikipedia.org/wiki/Comet_%28programming%29">here</a></p>
<h3>5. pubsubhubbub</h3>
<p>pubsubhubbub is a simple, open, server-to-server web-hook-based pubsub (publish/subscribe) protocol as an extension to Atom and RSS.</p>
<p>Currently this is the most rapidly adopting technology to push new content from server side to the client side. Parties (servers) speaking the <em>Pubsubhubbub</em> protocol can get near-instant notifications (via web hook callbacks) when a topic (feed URL) they&#8217;re interested in is updated.</p>
<p>This architecture composed of a publisher, subscriber and a hub. Publisher delegates the responsibility of distributing new content to the hub. Subscribers initially require subscribing to this hub, in order to get new content delivered. Whenever the new content is added, publisher notifies the hub about the changes so that hub “pushes” the content to its subscriber’s in real time.</p>
<p>Read more about pubsubhubbub <a href="http://code.google.com/p/pubsubhubbub/">here</a></p><br />Filed under: <a href='http://dunithd.wordpress.com/category/real-time-web/'>Real-time web</a> Tagged: <a href='http://dunithd.wordpress.com/tag/comet/'>comet</a>, <a href='http://dunithd.wordpress.com/tag/long-polling/'>long polling</a>, <a href='http://dunithd.wordpress.com/tag/pubsubhubbub/'>pubsubhubbub</a>, <a href='http://dunithd.wordpress.com/tag/real-time-web-2/'>real-time web</a>, <a href='http://dunithd.wordpress.com/tag/rss/'>rss</a>, <a href='http://dunithd.wordpress.com/tag/web-hooks/'>web hooks</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=105&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2010/05/05/real-time-web-making-web-real-time-with-push-technology/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>
	</item>
		<item>
		<title>Hypothetical architecture to federate well known micro blogging services</title>
		<link>http://dunithd.wordpress.com/2010/02/15/hypothetical-architecture-to-federate-well-known-micro-blogging-services/</link>
		<comments>http://dunithd.wordpress.com/2010/02/15/hypothetical-architecture-to-federate-well-known-micro-blogging-services/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 07:07:47 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[micro blogging]]></category>
		<category><![CDATA[pubsubhubbub]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=98</guid>
		<description><![CDATA[Background Perhaps you might familiar with well reputed social networking websites like Facebook and MySpace and may have experienced the intuitive user experience they offer. Most of social networking websites offer its users a publicly accessible profile page which consists of personal information of that user. They might be user&#8217;s biography, photos, videos and any [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=98&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->Perhaps you might familiar with well reputed social networking websites like <a href="http://www.facebook.com" target="_blank"><em>Facebook</em></a> and <a href="http://www.myspace.com" target="_blank"><em>MySpace</em></a> and may have experienced the  intuitive user experience they offer. Most of social networking websites offer its users a publicly accessible profile page which consists of personal information of that user. They might be user&#8217;s biography, photos, videos and any other sharable things. Now most of the social networking websites go beyond that level and displays micro blog updates associated with each user profile. For example, a website X may display Twitter updates of user Y in his profile page. Whenever  user Y updates his status on <a href="http://www.twitter.com"><em>Twitter</em></a>, user&#8217;s profile on website X will be get updated automatically or it is synchronized with Twitter.</p>
<h3>Requirement</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->Imagine I&#8217;m a web developer and I&#8217;m planning to develop a social networking website to host  profiles of different people. In order to keep the current trend, I need to display micro blog updates in the profile page of a given user. If the user in this case happens to have a <em>Twitter</em> account, I have to display his <em>Twitter</em> feeds in the profile page. Obviously  most users tend to have several micro blogging websites other than <em>Twitter</em>. So I have to offer more connectivity and synchronization facility to my users.</p>
<h3>Problem</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->Finally I decided to display micro blog updates from 5 well reputed websites. Those are <a href="http://www.twitter.com"><em>Twitter</em></a>, <a href="http://www.flickr.com"><em>Flickr</em></a>, <a href="http://www.youtube.com"><em>Youtube</em></a>, <a href="http://www.facebook.com"><em>Facebook</em></a> and <a href="http://www.wordpress.com"><em>WordPress</em></a> ( You can substitute any other five regardless of them). Whenever the user made a change in one of the above  websites, my website MUST synchronize the changes and display them on user&#8217;s profile page. For instance, if this user post a blog on <em>WordPress</em>, my website should have published a link (shortened URL of the post) on his profile automatically. But how?</p>
<p>As you know, most of the micro blogging websites provide their own API to access their content( such as Feeds,Users,Search) programmatically via simple HTTP requests.  They are in XML or Jason format. In order to consume their content in my web application, I have to write several client scripts for each of these websites. If any website modifies its API, I have to rewrite my script too.</p>
<p>Different websites produce different output and they haven&#8217;t got unified format across all the sites. <em>Twitter</em>&#8216;s status update notification response is different from <em>Flickr</em>&#8216;s new photo upload notification response. So I have to aware of each and every website I&#8217;m pulling content and parse and cast their responses into common format before I make use them.</p>
<p>Another issue is synchronization. At least I should provide a near real time synchronization between above five websites. Simple and most common way is to polling each website periodically for new content. In order to get the most updated content, I have to poll all five websites repeatedly. This is rather unpleasant and an overhead for my web server.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->So if I summarize above scenarios, following problems can be presented</p>
<ol>
<li>I have to write API clients for each website and keep in 	touch with their API updates.</li>
<li>I have to validate,parse and cast their content in to a 	common format by myself.</li>
<li>I have to poll each website repeatedly for new content so 	that it would make my server overloaded.</li>
</ol>
<div id="attachment_99" class="wp-caption aligncenter" style="width: 642px"><a href="http://dunithd.files.wordpress.com/2010/02/1.jpg"><img class="size-full wp-image-99" title="Problems arised" src="http://dunithd.files.wordpress.com/2010/02/1.jpg?w=632&#038;h=557" alt="" width="632" height="557" /></a><p class="wp-caption-text">Problems arised with current issue</p></div>
<p style="text-align:center;">
<h3>Solution</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->In order to solve above problems, I&#8217;d like to suggest a new architecture to consume micro blog updates from well known websites.</p>
<div id="attachment_100" class="wp-caption aligncenter" style="width: 642px"><a href="http://dunithd.files.wordpress.com/2010/02/2.jpg"><img class="size-full wp-image-100" title="2" src="http://dunithd.files.wordpress.com/2010/02/2.jpg?w=632&#038;h=514" alt="" width="632" height="514" /></a><p class="wp-caption-text">Suggested architecture for federating</p></div>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->This architecture is made of well known micro blogging services(publishers), their subscribers(nodes) and centralized hub. There can be many hubs exist and for each hub, it can have many nodes subscribed to it. According to above architecture, I made a decision to <strong>keep complexity at the center hub and make nodes simple.</strong></p>
<p>This architecture is somewhat different from <em>Google&#8217;s <a href="http://code.google.com/pubsubhubbub/">pubsubhubbub</a></em>. In pubsubhubbub, publishers can push their updates in to the hub and notify them about new updates. But in this architecture, hub polls its publishers for new content or pulls new content. This is because there is no way to tell  micro blogging services about notifying the hub when new content is arrived. Well is there anyway to do that, you can suggest me.</p>
<p>In this architecture, all I have to do is just telling the hub about what are the micro blogging services I&#8217;m interested in. Then hub will takes the responsibility of pulling off the new content and notifying me the changes.</p>
<p><strong>Hub –</strong> This is a server application written in Java NIO and the critical application component in this architecture so that it shields its client&#8217;s by acquiring  following responsibilities to itself.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<ul>
<li>Hub has already implemented 	the client scripts for several well known micro blogging websites 	including <em>Twitter</em> and <em>Flickr</em>. 	So consumers do not need to care about the API client implementation 	of their own. This makes their development process more efficient 	and convenient.</li>
<li>Hub consumes/pulls content from 	several micro blogging services and crunch them in to a common 	format which is unified and completely detached from their original 	format. So client consumers no longer required to validate, parse 	and cast the responses of micro blogging services by them selves 	because hub takes that responsibility.</li>
<li>Hub periodically polls each 	micro blogging service to pull new updates. Whenever hub receives 	new updates, it notifies its subscribed nodes about the new update. 	All update notifications which are flowing from hub to nodes, are in 	single unified format(RSS/Atom). So consumer clients no longer 	required to poll for new content.</li>
</ul>
<h3>Implementation</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->Currently I&#8217;m in the process of designing the hub. I&#8217;ll use Java as the programming language and code will be hosted at <em>Google Code</em>. Soon I&#8217;ll publish the design documents and let you know about new proceedings by extending this post.</p>
<p>I warmly welcome your comments on this architecture. Perhaps you could contribute by adding a API client for well known micro blogging services like <em>Flickr</em> or you can help me to enhance this architecture by introducing the concept of <em>web hooks</em>.</p><br />Filed under: <a href='http://dunithd.wordpress.com/category/software-architecture/'>Software Architecture</a> Tagged: <a href='http://dunithd.wordpress.com/tag/architecture/'>architecture</a>, <a href='http://dunithd.wordpress.com/tag/atom/'>atom</a>, <a href='http://dunithd.wordpress.com/tag/micro-blogging/'>micro blogging</a>, <a href='http://dunithd.wordpress.com/tag/pubsubhubbub/'>pubsubhubbub</a>, <a href='http://dunithd.wordpress.com/tag/rss/'>rss</a>, <a href='http://dunithd.wordpress.com/tag/twitter/'>twitter</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=98&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2010/02/15/hypothetical-architecture-to-federate-well-known-micro-blogging-services/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2010/02/1.jpg" medium="image">
			<media:title type="html">Problems arised</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2010/02/2.jpg" medium="image">
			<media:title type="html">2</media:title>
		</media:content>
	</item>
		<item>
		<title>Suggested Stomp transport for Apache Axis2</title>
		<link>http://dunithd.wordpress.com/2009/12/25/suggested-stomp-transport-for-apache-axis2/</link>
		<comments>http://dunithd.wordpress.com/2009/12/25/suggested-stomp-transport-for-apache-axis2/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 17:06:50 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Apache Axis2]]></category>
		<category><![CDATA[ActiveMQ]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Axis2]]></category>
		<category><![CDATA[Gozirra]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JMS]]></category>
		<category><![CDATA[Message Broker]]></category>
		<category><![CDATA[Stomp]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=87</guid>
		<description><![CDATA[Apache Axis2 is a leading open source software that provides the basis for the web services stack and supports both SOAP ( Simple Object Access Protocol) and REST (Representational State Transfer). In addition to that, it acts as the foundation for building complete web services stack with Apache Rampart, Rahas,Sandesha2 and Kandula2 providing support for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=87&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="text-align:justify;"><a href="http://ws.apache.org/axis2/" target="_blank">Apache Axis2</a> is a leading open source software that provides the basis for the web services stack and supports both SOAP ( Simple Object Access Protocol) and REST (Representational State Transfer). In addition to that, it acts as the foundation for building complete web services stack with <a href="http://ws.apache.org/rampart/" target="_blank">Apache Rampart</a>, Rahas,<a href="http://ws.apache.org/sandesha/" target="_blank">Sandesha2</a> and <a href="http://ws.apache.org/kandula/" target="_blank">Kandula2</a> providing support for all key web services specification.</p>
<p style="text-align:justify;">Axis2 has flexible and scalable architecture compared to  its predecessor Axis and it provides lot of support for extending its core functionality. Axis2 consists of pluggable modules, systems, event listeners and pluggable transport framework with very useful extension points. One such a great feature of  Axis2 is transport independence. It doesn&#8217;t depend on any specific transport  and its up to the user to select best transport to meet his requirements.</p>
<p style="text-align:justify;"><span style="color:#993366;">In this article, I&#8217;m not going to explain about  what  is Axis2 and all its  features, instead   I&#8217;m going to show   you my attempt to write a new transport for Axis2 based on the <a href="http://stomp.codehaus.org/" target="_blank">Stomp</a> protocol</span>. Before reading the rest of the article, I recommend you to get an idea about the Axis2 architecture.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Nimbus Sans L", sans-serif } --></p>
<h3>Role of a Message Broker in SOAP message delivery</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="text-align:justify;">If you need to send a SOAP message to Axis2, there are many ways to transport the SOAP message into the Axis engine. The most standard and flexible way is SOAP over HTTP. But when it comes to the reliability of the transport, it fails. After submitting the SOAP message, HTTP has no guarantee about its delivery.  When we consider mission critical systems with zero down times, HTTP may not be the proper transportation option.</p>
<p style="text-align:justify;">Message Oriented Middleware(MOM) can be helpful in such situations. They are often called &#8216;Message Brokers&#8217; and they provide asynchronous message delivery between heterogeneous systems. Message brokers decouple the senders of messages from  the consumers of the messages. The senders and consumers of the messages are completely independent and know nothing about each other.</p>
<p style="text-align:justify;">The key feature of a broker is reliable messaging. With reliable messaging, broker is responsible for  delivering messages one and only once for its subscriber. Message level security, Transaction support, message persistence and scalability are other noteworthy features of a message broker.</p>
<p style="text-align:justify;">JMS(Java Messaging Service) provides rich set of Java API to communicate with any JMS compliant message broker. So developers found that SOAP over JMS is a better alternative to SOAP over HTTP, when it comes to reliability and guaranteed delivery.</p>
<p style="text-align:justify;">But the problem was JMS is only for Java. In order to communicate with message brokers, open standard protocols such as AMQP and Stomp were defined and they can be used with any language.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Nimbus Sans L", sans-serif } --></p>
<h3>What is Stomp?</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="text-align:justify;"><a href="http://stomp.codehaus.org/" target="_blank">Stomp</a> is a very simple protocol to communicate with any Stomp supported message broker. Currently <a href="http://activemq.apache.org/" target="_blank">Apache ActiveMQ</a> has a very good support for Stomp including SSL, Non blocking IO (NIO) and message persistence.</p>
<p style="text-align:justify;">Unlike JMS(Java Messaging Service), Stomp has a wire format so that it can be implemented by any language with very little effort.  So Stomp already has clients with scripting languages  such as Ruby, PHP and Python.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Nimbus Sans L", sans-serif } --></p>
<h3>Anatomy of the  Stomp transport for Axis2</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="text-align:justify;">Before reading this section, I assume you may have a good understanding about the Axis2 architecture.</p>
<p style="text-align:justify;">As I mentioned earlier, Axis2 is independent of underlying transport mechanism. You can create any kind of transport as your wish and plug it into the Axis core. That is a one such a great flexibility in Axis2 architecture.</p>
<p style="text-align:justify;">In order to give you 10,000 feet view of my Stomp transport, just look at the figure below.</p>
<p style="text-align:justify;"><a href="http://dunithd.files.wordpress.com/2009/12/figure-1.png"><img class="aligncenter size-full wp-image-91" title="figure-1" src="http://dunithd.files.wordpress.com/2009/12/figure-1.png?w=632&#038;h=474" alt="" width="632" height="474" /></a></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="text-align:justify;">As the figure depicts, two queues are used as message destinations. They can be two separate queues in the same broker or two separate queues in different brokers. Selection is up to you. This architecture  resembles the JMS point-to-point messaging paradigm.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --><strong>Execution Sequence</strong></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->Let me show you how web service client invokes a web service hosted in Axis2  using SOAP over Stomp.</p>
<ol>
<li>User application needs to make 	a SOAP request and it delegates the responsibility to <strong>Axis Client API</strong> with necessary data.</li>
<li><strong>AxisEngine</strong> creates the 	<strong>MessageContext</strong> object and pass it to he <strong>StompSender</strong>.</li>
<li><strong>StompSender</strong> creates a 	Stomp message and populates it with Stomp specific information and 	data extracted from the <strong>MessageContext</strong>. Body of the message 	contains the <strong>SOAP Request</strong>.</li>
<li><strong>StompSender</strong> places that 	Stomp message in <strong>inbound queue</strong>.</li>
<li>In the server side, <strong>StompListener</strong> is subscribed to the inbound queue and it will receive the Stomp 	message when it is placed on the queue.</li>
<li><strong>StompListener</strong> dispatches 	the stomp message and extracts the SOAP request and starts building 	the <strong>MessageContext</strong>.</li>
<li>After building the 	<strong>MessageContext</strong>, StompListener passes it to  the Axis Engine 	to be processed.</li>
<li><strong>AxisEngine</strong> sends the 	processed <strong>MessageContext</strong> into <strong>StompSender</strong> and it 	starts building a Stomp message using the data extracted from 	<strong>MessageContext</strong>.</li>
<li>Server side <strong>StompSender</strong> places the Stomp message in reply queue.</li>
<li>Client side <strong>StompListener</strong> is subscribed to the reply queue it will receive the Stomp message.</li>
<li>[6] and [7] steps are repeated in 	the client side. Once the reply message is processed, it will be 	passed back to the user application.</li>
</ol>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Nimbus Sans L", sans-serif } --></p>
<h3>Classes involved in the Stomp transport</h3>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->Stomp transport consist of following classes.</p>
<ol>
<li>
<p style="text-align:justify;"><strong>StompListener</strong></p>
<p style="text-align:justify;">This is the listening interface for the incoming Stomp messages. 	This class implements the <strong>TransportListener</strong> interface and takes the 	responsibility of constructing <strong>StompConnection</strong> objects 	according to the <strong>axis2.xml</strong> file. Each constructed <strong>StompConnection</strong> object is assigned with an instance of new <strong>StompPacketListener</strong>. This 	happens only once when <strong>ListenerManager</strong> calls the <strong>init()</strong> method of the <strong>StompListener</strong>.</p>
</li>
<li><strong>StompConnection</strong>This class abstracts the connection information that are useful 	to establish a connection with a message broker. Examples are 	host,port, login credentials and destination names. Usually these 	information are obtained through <strong>ConfigurationContext</strong> object and <strong> StompListener</strong> takes the responsibility of extracting them from <strong> ConfigurationContext</strong> and populating new <strong>StompConnections</strong>.</li>
<li><strong>StompPacketListener</strong>This is the actual dispatcher of a Stomp message. After calling 	the <strong>init()</strong> method of the <strong>StompListener</strong>, several <strong> StompConnections</strong> may exist and each one is assigned with their own <strong> StompPacketListener</strong>. <strong>StompPacketListener</strong> objects subscribes to the 	Inbound queue or Reply queue, depending on the situation. (If client 	side, then reply queue. Else they subscribe to the inbound queue).</li>
</ol>
<p style="text-align:center;"><a href="http://dunithd.files.wordpress.com/2009/12/dispatching.gif"><img class="aligncenter size-full wp-image-92" title="Dispatching" src="http://dunithd.files.wordpress.com/2009/12/dispatching.gif?w=632" alt=""   /></a></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->according to the above figure, same worker thread pool is shared between all 	StompPacketListener instances. Whenever Stomp packet is received, StompPacketListener pick 	up  a worker thread from worker pool and delegates the dispatching process to that thread.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } -->4.<strong> StompSender</strong></p>
<p style="padding-left:30px;">This is the opponent to the StompListener. This class is 	responsible for extracting information from MessageContext and 	populating a new stomp message. Also it delivers the message to the 	inbound or reply queue, depending on the situation.</p>
<p>5<strong>.  StompMessage</strong></p>
<p style="padding-left:30px;">This class merely contains the data 	that is received with a Stomp packet.</p>
<p>6.  <strong>StompUtils</strong></p>
<p style="padding-left:30px;">This class consists of utility 	methods.</p>
<p>7. <strong>StompConstants</strong></p>
<p style="padding-left:30px;">Constants that are related to this 	transport are defined here. This includes the transport name and 	several service parameters.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Nimbus Sans L", sans-serif } --></p>
<h3>Third party libraries used</h3>
<p>I used <a href="http://www.germane-software.com/software/Java/Gozirra/" target="_blank"><strong>Gozirra</strong></a> Java client for Stomp to make communications with the message broker. But its too simple and lack of good design features. So I&#8217;ll be writing my own Stomp client to use with this transport in near future.</p>
<h3>Conclusion</h3>
<p>Up to this point, I&#8217;ve implemented all the classes I mentioned and code is now in testing phase and I appreciate your comments on this.</p>
<p>I&#8217;ll make  another post about how to build this transport with Axis2 source and configurations for axis2.xml.</p>
<p>So stay tuned&#8230;</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --> <!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --> <!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="padding-left:30px;">
<p style="padding-left:30px;">
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p><br />Posted in Apache Axis2 Tagged: ActiveMQ, Apache, Axis2, Gozirra, HTTP, JMS, Message Broker, Stomp <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=87&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2009/12/25/suggested-stomp-transport-for-apache-axis2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2009/12/figure-1.png" medium="image">
			<media:title type="html">figure-1</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2009/12/dispatching.gif" medium="image">
			<media:title type="html">Dispatching</media:title>
		</media:content>
	</item>
		<item>
		<title>Speedy &#8211; Painless rapid Rails deployment</title>
		<link>http://dunithd.wordpress.com/2009/12/10/speedy-painless-rapid-rails-deployment/</link>
		<comments>http://dunithd.wordpress.com/2009/12/10/speedy-painless-rapid-rails-deployment/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 19:54:40 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Speedy]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=84</guid>
		<description><![CDATA[If you are a Ruby developer, perhaps  you would encounter problems in creating virtual hosts on the your development server during the application development phase. Since this is a repetitive task, you would be in great trouble when it comes to the deployment. But fortunately my friend Mohamed Aslam got a solution for this with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=84&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are a Ruby developer, perhaps  you would encounter problems in creating virtual hosts on the your development server during the application development phase. Since this is a repetitive task, you would be in great trouble when it comes to the deployment.</p>
<p>But fortunately my friend <a href="http://mohamedaslam.com/">Mohamed Aslam</a> got a solution for this with his new ruby gem called &#8216;Speedy&#8217;. As it name suggests, Speedy is a great solutions for rapid web application development with Rails framework.</p>
<p>Go ahead and check that out on  <a href="http://speedy.mohamedaslam.com/" target="_blank">http://speedy.mohamedaslam.com/</a></p>
<p>Also Aslam presents very nice video tutorial about installing Speedy on your PC.</p><br /> Tagged: Rails, Ruby, Speedy <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=84&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2009/12/10/speedy-painless-rapid-rails-deployment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>
	</item>
		<item>
		<title>Send E-Mail using JavaMail from behind a proxy server</title>
		<link>http://dunithd.wordpress.com/2009/11/14/send-e-mail-using-javamail-from-behind-a-proxy-server/</link>
		<comments>http://dunithd.wordpress.com/2009/11/14/send-e-mail-using-javamail-from-behind-a-proxy-server/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 03:47:34 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[JavaMail]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=80</guid>
		<description><![CDATA[If you trying to send an email using JavaMail API from behind a proxy server you would get &#8216;UnknownHostException&#8217; . Thats because the proxy server doesn&#8217;t allow SMTP traffic through it. One of my friend Indika Tantrigoda suggested me a forum thread that contains a good solution for this. So this is the forum link [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=80&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you trying to send an email using JavaMail API from behind a proxy server you would get &#8216;UnknownHostException&#8217; . Thats because the proxy server doesn&#8217;t allow SMTP traffic through it.</p>
<p>One of my friend <a title="See him on Twitter" href="http://twitter.com/indit" target="_blank">Indika Tantrigoda </a> suggested me a forum thread that contains a good solution for this.</p>
<p>So this is the forum link</p>
<p><a href="http://forums.sun.com/thread.jspa?threadID=615715">http://forums.sun.com/thread.jspa?threadID=615715</a></p>
<p>I think you may find a better answer&#8230;</p>
<p>&nbsp;</p><br />Posted in JavaMail Tagged: JavaMail, proxy <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=80&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2009/11/14/send-e-mail-using-javamail-from-behind-a-proxy-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>
	</item>
		<item>
		<title>Send E-mail with attachments using JavaMail</title>
		<link>http://dunithd.wordpress.com/2009/11/14/send-e-mail-with-attachments-using-javamail/</link>
		<comments>http://dunithd.wordpress.com/2009/11/14/send-e-mail-with-attachments-using-javamail/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 03:27:47 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[JavaMail]]></category>
		<category><![CDATA[attachement]]></category>
		<category><![CDATA[Gmail]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=75</guid>
		<description><![CDATA[As I promised in my earlier post ‘Send E-mail using JavaMail API and your GMail account’ I’ll show you how to send an email with an attachment using JavaMail API (http://java.sun.com/products/javamail). Basic steps are similar to my previous post . So before proceed with this one, I recommend you to refer my previous article, in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=75&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I promised in my earlier post ‘<a href="http://dunithd.wordpress.com/2009/10/22/send-email-using-javamail-api-and-your-gmail-account/" target="_blank">Send E-mail using JavaMail API and your GMail account</a>’ I’ll show you how to send an email with an attachment using JavaMail API (<a href="http://java.sun.com/products/javamail">http://java.sun.com/products/javamail</a>).</p>
<p>Basic steps are similar to my previous post . So before proceed with this one, I recommend you to refer my previous article, in order to get a basic idea.</p>
<p>If you need to send an email with an attachment, first you need to construct a <strong>MimeMultipart</strong> message. <strong>MimeMultipart</strong> message is composed of <strong>MimeBodyPart </strong>messages. You can attach your file in to <strong>MimeBodyPart</strong> message and then <strong>MimeBodyPart</strong> can be further added to <strong>MimeMultipart</strong> message. Finally <strong>MimeMultipart</strong> message can be added to basic <strong>MimeMessage</strong> by calling its setContent (<strong>MimeMultipart</strong> message) method.</p>
<p>This relationship is illustrated below.</p>
<div id="attachment_76" class="wp-caption aligncenter" style="width: 490px"><a href="http://dunithd.files.wordpress.com/2009/11/blg20091114.png"><img class="size-full wp-image-76" title="Hierarchical view of different messages" src="http://dunithd.files.wordpress.com/2009/11/blg20091114.png?w=632" alt="Hierarchical view of different messages"   /></a><p class="wp-caption-text">Hierarchical view of different messages</p></div>
<p>You can download the complete source code for the application <a title="Download the source code" href="http://www.filepanda.com/file/xfaqxvkbhrqj/" target="_blank">here</a></p><br />Posted in JavaMail Tagged: attachement, Gmail, JavaMail <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=75&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2009/11/14/send-e-mail-with-attachments-using-javamail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2009/11/blg20091114.png" medium="image">
			<media:title type="html">Hierarchical view of different messages</media:title>
		</media:content>
	</item>
		<item>
		<title>Add &#8216;Open Terminal&#8217; to Gnome context menu in Ubuntu</title>
		<link>http://dunithd.wordpress.com/2009/11/07/add-open-terminal-to-gnome-context-menu-in-ubuntu/</link>
		<comments>http://dunithd.wordpress.com/2009/11/07/add-open-terminal-to-gnome-context-menu-in-ubuntu/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 03:35:19 +0000</pubDate>
		<dc:creator>dunithd</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[nautilus]]></category>

		<guid isPermaLink="false">http://dunithd.wordpress.com/?p=69</guid>
		<description><![CDATA[Gnome ships with the absence of a killer desktop tweak called &#8216;Open Terminal&#8217;. This simple feature lets you open a new terminal, when you right click on a folder. I was really wondering  why this feature is not included in Ubuntu distros. How to install it? Open a new terminal and type sudo apt-get install [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=69&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Gnome ships with the absence of a killer desktop tweak called &#8216;Open Terminal&#8217;. This simple feature lets you open a new terminal, when you right click on a folder. I was really wondering  why this feature is not included in Ubuntu distros.</p>
<p><strong>How to install it?</strong></p>
<p>Open a new terminal and type</p>
<pre>sudo apt-get install <span style="font-family:Courier,monospace;">nautilus-open-terminal</span></pre>
<p><span style="font-family:Courier,monospace;"> </span></p>
<pre><span style="font-family:Courier,monospace;">
</span></pre>
<p>Then log out and log in again to restart the Gnome. Now it should looks like this&#8230;</p>
<div id="attachment_71" class="wp-caption aligncenter" style="width: 412px"><a href="http://dunithd.files.wordpress.com/2009/11/open-terminal.png"><img class="size-full wp-image-71" title="After installing 'Open Terminal'" src="http://dunithd.files.wordpress.com/2009/11/open-terminal.png?w=632" alt="After installing 'Open Terminal'"   /></a><p class="wp-caption-text">After installing &#39;Open Terminal&#39;</p></div><br />Posted in Ubuntu Tagged: gnome, nautilus, Ubuntu <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dunithd.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dunithd.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dunithd.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dunithd.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dunithd.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dunithd.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dunithd.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dunithd.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dunithd.wordpress.com&amp;blog=2334515&amp;post=69&amp;subd=dunithd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dunithd.wordpress.com/2009/11/07/add-open-terminal-to-gnome-context-menu-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c7860f185b8a17dcb7485a50b17e350?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duischen</media:title>
		</media:content>

		<media:content url="http://dunithd.files.wordpress.com/2009/11/open-terminal.png" medium="image">
			<media:title type="html">After installing &#039;Open Terminal&#039;</media:title>
		</media:content>
	</item>
	</channel>
</rss>
