<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-679068030804153090</id><updated>2026-10-14T00:21:34.090-07:00</updated><title type='text'>Second Screen Re-targeting</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-5369703118816150891</id><published>2013-12-03T10:23:00.001-08:00</published><updated>2013-12-03T10:24:07.787-08:00</updated><title type='text'>Install Storm Cluster on Mac</title><content type='html'>In this blog, I will show how to install Storm cluster on Mac and some of the challenges I ran into and how to troubleshoot and resolve those issues. In the next blog, I will show how to use RabbitMQ spout and write the word count result to Redis.&lt;br /&gt;
&lt;h2&gt;
Storm&#39;s Major Components&lt;/h2&gt;
Storm consists of four major components,&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Zookeeper&lt;/li&gt;
&lt;li&gt;zeroMQ&lt;/li&gt;
&lt;li&gt;jzmq (java bridge for zeroMQ)&lt;/li&gt;
&lt;li&gt;Storm&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Start &lt;a href=&quot;http://storm-project.net/&quot;&gt;here&lt;/a&gt;&amp;nbsp;if one wants to read more about Storm.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Installing Storm in Development Environment&lt;/h2&gt;
&lt;div&gt;
Follow the instruction &lt;a href=&quot;http://jianwen.me/posts/2012/04/set-up-twitter-storm-development-environment-on-mac-os-x-lion/&quot;&gt;here&lt;/a&gt; if one wants to set up Storm in development environment.&lt;/div&gt;
&lt;h2&gt;
Install Storm Cluster on Mac&lt;/h2&gt;
&lt;div&gt;
Our challenge, however is to install storm cluster on a single Mac. &lt;a href=&quot;http://10jumps.com/blog/storm-installation-single-machine&quot;&gt;Here&lt;/a&gt; is a good article on how to accomplish that, with one single exception. &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Instead of installing jzmq mentioned in the article, one must install this &lt;a href=&quot;https://github.com/cbsmith/jzmq&quot;&gt;branch&lt;/a&gt; of jzmq for Mac.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
More on this topic in later sections.&lt;br /&gt;
&lt;h2&gt;
Start and Test Storm Cluster&lt;/h2&gt;
&lt;h3&gt;
Start ZooKeeper &lt;/h3&gt;
sudo ./zkServer.sh start&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Start Storm Cluster&lt;/h3&gt;
Depending on where one configures storm to store its temporary data, one might need to start storm through sudo. &lt;br /&gt;
&lt;h4&gt;
Start Nimbus&lt;/h4&gt;
&amp;nbsp;sudo ./storm nimbus&lt;br /&gt;
&lt;h4&gt;
Start Supervisor&lt;/h4&gt;
sudo ./storm supervisor &lt;br /&gt;
&lt;h4&gt;
Start UI&lt;/h4&gt;
sudo ./storm ui&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;h3&gt;
Check Storm UI and Verify Storm cluster is up and Running&lt;/h3&gt;
Go to http://localhost:8080 and one should see the following screen,&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggPuxSeZEM2TOjZXvfsvQYfbUdHD4gb-sHMwW4sGSlN7TxgH95diSiXZzywFlXCqBkgeA-3BeLKVh3l15C7s06lEDE1Ou1ecgdW4Zv76-RAhYb3AtEsWWEx5ddMXb6kop5VRPvk6zI1-7F/s1600/Screen+Shot+2013-11-27+at+12.38.55+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggPuxSeZEM2TOjZXvfsvQYfbUdHD4gb-sHMwW4sGSlN7TxgH95diSiXZzywFlXCqBkgeA-3BeLKVh3l15C7s06lEDE1Ou1ecgdW4Zv76-RAhYb3AtEsWWEx5ddMXb6kop5VRPvk6zI1-7F/s640/Screen+Shot+2013-11-27+at+12.38.55+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Build and Deploy Storm-Starter to Storm Cluster&lt;/h3&gt;
&lt;h4&gt;
Download Storm-Starter &lt;/h4&gt;
Download storm-starter from Githut,&lt;br /&gt;
git clone https://github.com/nathanmarz/storm-starter.git&lt;br /&gt;
&lt;h4&gt;
Build and Package Storm-Starter&lt;/h4&gt;
cd storm-starter&lt;br /&gt;
mvn&amp;nbsp; -f m2-pom.xml package&lt;br /&gt;
&lt;br /&gt;
This will produce storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar under target directory.&lt;br /&gt;
&lt;h4&gt;
Deploy and Run a Topology&lt;/h4&gt;
storm jar  storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.WordCountTopology WordCountTopology&lt;br /&gt;
&lt;br /&gt;
If everything deploys correctly, one should see the following messages,
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  [main] INFO backtype.storm.StormSubmitter - Jar not uploaded to master yet. Submitting jar...  
 10  [main] INFO backtype.storm.StormSubmitter - Uploading topology jar storm-starter-0.0.1-SNAPSHOT.jar to assigned location: /usr/local/var/run/zookeeper/data/nimbus/inbox/stormjar-19e2b1f9-df68-4105-b409-b4190d3d4efa.jar  
 76  [main] INFO backtype.storm.StormSubmitter - Successfully uploaded topology jar to assigned location: /usr/local/var/run/zookeeper/data/nimbus/inbox/stormjar-19e2b1f9-df68-4105-b409-b4190d3d4efa.jar  
 76  [main] INFO backtype.storm.StormSubmitter - Submitting topology wordCountToplogy in distributed mode with conf {&quot;topology.workers&quot;:3,&quot;topology.debug&quot;:true}  
 431 [main] INFO backtype.storm.StormSubmitter - Finished submitting topology: wordCountToplogy  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now, go back to storm ui and we should see the newly deployed topology shows up.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIs5nNZK6X1wk2_T1tXhT-RhtOnQq8iuAv77nPORuuk01Z5idvk9YPiAPgqQSzjC_r7LGDTH9l_gx4PZpjCBUH1iJSmJWCiMXXzjBSFynm8I62Ww0DT-Pt1toQA4NsCWdkcwwcAcEbY9DN/s1600/Screen+Shot+2013-11-27+at+1.09.57+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;416&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIs5nNZK6X1wk2_T1tXhT-RhtOnQq8iuAv77nPORuuk01Z5idvk9YPiAPgqQSzjC_r7LGDTH9l_gx4PZpjCBUH1iJSmJWCiMXXzjBSFynm8I62Ww0DT-Pt1toQA4NsCWdkcwwcAcEbY9DN/s640/Screen+Shot+2013-11-27+at+1.09.57+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
Even though the topology shows up in the ui, this doesn&#39;t mean storm is working properly. We need to drill down at the actual topology level to verify that storm is working properly by verifying that the number of emitted and transformed messages are greater than zero.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWrjNiABd2kWrglT5LuoP7gcbqe1yU0xWPHS4SfI7ORocqXHnli6_qBBIk4MXiGGoOcRaS6mOXzEheuDq57W06WNjbYyoYKVJ2X8SMDFGo8gkPjz-GruhLXLQmIe77sToiVXcLpJbYjD6M/s1600/Screen+Shot+2013-11-27+at+1.10.08+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;506&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWrjNiABd2kWrglT5LuoP7gcbqe1yU0xWPHS4SfI7ORocqXHnli6_qBBIk4MXiGGoOcRaS6mOXzEheuDq57W06WNjbYyoYKVJ2X8SMDFGo8gkPjz-GruhLXLQmIe77sToiVXcLpJbYjD6M/s640/Screen+Shot+2013-11-27+at+1.10.08+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h3&gt;
Stop or kill a Topology&lt;/h3&gt;
&lt;div&gt;
./storm kill wordCountTopology&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTgR2_Z932Qo_jFt2TM98PLNRLjmWeCAgDUTouF-zrjkej7nyeAZN3NprYrLkumvfoNFw39RW6gSQOR52QTWzZZ581EjcDlKxURrjjaHPn_kwcuIOeQxDPNfPzzlsfqxvyGx5dDqxIhs-Y/s1600/killed-topology.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;378&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTgR2_Z932Qo_jFt2TM98PLNRLjmWeCAgDUTouF-zrjkej7nyeAZN3NprYrLkumvfoNFw39RW6gSQOR52QTWzZZ581EjcDlKxURrjjaHPn_kwcuIOeQxDPNfPzzlsfqxvyGx5dDqxIhs-Y/s640/killed-topology.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;h2&gt;
Where things could go wrong&lt;/h2&gt;
There are many things could go wrong when setting up a storm cluster, from incompatible zeroMQ/jzmq, to file permission issue that can cause countless hours of frustration and searching the Internet. Here are some of the problems I ran into and how I managed to resolve them.&lt;br /&gt;
&lt;h3&gt;
Log files are your Friend&lt;/h3&gt;
&lt;div&gt;
The log files for nimbus, supervisor, and ui are placed under STORM_HOME/logs directory. In addition to nimbus.log, supervisor.log, ui.log, one should find worker-6700.log, worker-6701.log, worker6702.log etc. Go through these log files to make sure there is no error or exception in the log files. If there is a file permission related error, one should be able to spot it in one of the log files.&lt;/div&gt;
&lt;h3&gt;
zeroMQ and jzmq compatibility&lt;/h3&gt;
&lt;div&gt;
The other hard to track down issue is mostly related to zeroMQ and jzqm bridge.&amp;nbsp;&lt;/div&gt;
&lt;h4&gt;
Only Use zeroMQ version 2.1.7&lt;/h4&gt;
&lt;div&gt;
If one gets an invalid parameter exception for zeroMQ, the wrong zeroMQ version is used.&lt;/div&gt;
&lt;h4&gt;
Only Use the Correct jzmq for Mac&lt;/h4&gt;
&lt;div&gt;
&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Instead of installing jzmq mentioned in the article, one must install this&amp;nbsp;&lt;a href=&quot;https://github.com/cbsmith/jzmq&quot;&gt;branch&lt;/a&gt;&amp;nbsp;of jzmq for Mac.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h4&gt;
What happens when my worker thread keeps crashing&lt;/h4&gt;
&lt;div&gt;
If the supervisor keeps reporting back that the worker thread keeps getting killed, and there is no exception in any of the log files, please check for hs_err_pid.log (pid is the process id) under STORM_HOME/bin directory or the directory where storm is launched. If one finds hs_err_pid.log files, chances are there is some incompatibility between the zeroMQ server and jzmq bridge. The hs_err_pid.log should have all the details.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The other options is to manually start the worker command by hand and see whether it can start up or crashes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
&amp;nbsp;&lt;/h3&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/5369703118816150891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2013/12/install-storm-cluster-on-mac.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/5369703118816150891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/5369703118816150891'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2013/12/install-storm-cluster-on-mac.html' title='Install Storm Cluster on Mac'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggPuxSeZEM2TOjZXvfsvQYfbUdHD4gb-sHMwW4sGSlN7TxgH95diSiXZzywFlXCqBkgeA-3BeLKVh3l15C7s06lEDE1Ou1ecgdW4Zv76-RAhYb3AtEsWWEx5ddMXb6kop5VRPvk6zI1-7F/s72-c/Screen+Shot+2013-11-27+at+12.38.55+PM.png" height="72" width="72"/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-1431990100498934993</id><published>2013-02-08T13:26:00.000-08:00</published><updated>2013-02-08T13:26:40.888-08:00</updated><title type='text'>Use Mule LDAP Connector to Create a New User</title><content type='html'>In this blog, we will show how to create a new user in openLDAP using Mule LDAP connector.&lt;br /&gt;
&lt;br /&gt;
This flow has been tested against a Mac openLDAP server, using the core schema. Also we need to setup an LDAP tree like ou=people,dc=example,dc=com .&lt;br /&gt;
&lt;br /&gt;
Here is the flow we are using,&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Receive create user request via HTTP GET request (only passing in dn, distinguished name)&lt;/li&gt;
&lt;li&gt;Look up dn from LDAP and return the lookup result&lt;/li&gt;
&lt;li&gt;If the lookup fails by a NameNoFoundException, the Exception flow is invoked&lt;/li&gt;
&lt;li&gt;A Java transform pulls out the dn and fills in a set of pre-defined user data (for demo purpose) and puts them in a map&lt;/li&gt;
&lt;li&gt;LDAP transformer transforms the map into an LDAPEntry&lt;/li&gt;
&lt;li&gt;LDAP connector is called to insert newly created LDAPEntry into LDAP&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
But first, we need to install LDAP connector by going to Mule Studio/Help/Install New Software. Select &quot;MuleStudio Cloud Connectors Update Site&quot; and search for &quot;ldap&quot;. Check &quot;LDAP Connector Mule Studio Extension&quot; and proceed to install it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzSarXaOF5M_kEa1bYx1SJqXWf9URQw8nHf-xaFInRixAHKOP-BStAORUnSxIAJ3C0hIZEZrLESCBv8hSfAQSKXi_ykM4OY3mtedx5QOWDwig-ig2eEm7AWeWDySTPhr6dsLTtaAKpkH-X/s1600/install-ldap-connector.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;524&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzSarXaOF5M_kEa1bYx1SJqXWf9URQw8nHf-xaFInRixAHKOP-BStAORUnSxIAJ3C0hIZEZrLESCBv8hSfAQSKXi_ykM4OY3mtedx5QOWDwig-ig2eEm7AWeWDySTPhr6dsLTtaAKpkH-X/s640/install-ldap-connector.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Next we need to configure an LDAP global element, by clicking on Global Elements&#39; &quot;Add&quot; button.&lt;/div&gt;
&lt;div&gt;
Search for &quot;ldap&quot; and select &quot;LDAP&quot; under &quot;Cloud Connectors&quot;, and click &quot;OK&quot;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnHPKTg9saO05P2bBIQE_jUvYhgGePG5DJ7uE_LIkd1byejdnO9fpq15MurOuxcmCS6VAGZRv0DT1YBS6I5Sq8zKsqdXMej3kDdcp2-703VQ6aYcJkrGaKHJq9O5AQwRH3MOhVXI995hU4/s1600/choose-global-type.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnHPKTg9saO05P2bBIQE_jUvYhgGePG5DJ7uE_LIkd1byejdnO9fpq15MurOuxcmCS6VAGZRv0DT1YBS6I5Sq8zKsqdXMej3kDdcp2-703VQ6aYcJkrGaKHJq9O5AQwRH3MOhVXI995hU4/s640/choose-global-type.png&quot; width=&quot;638&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Fill in &quot;Name&quot;, &quot;Principal DN&quot;, &quot;Password&quot;, and &quot;URL&quot;, click OK.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbCjn0j6gUV3z8lfDEdzYtQouc6wOSIWdSpqExDIBygkDx85J2BuxBxpZOxrJxZStHWVeN8d0IZ8v4_BW0alWkFAGj4rN2ysn8E0ZDXBxbf8AQdeNVhug9SYFKroTGS6Y2nev4ostsNgyf/s1600/ldap-global-element.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbCjn0j6gUV3z8lfDEdzYtQouc6wOSIWdSpqExDIBygkDx85J2BuxBxpZOxrJxZStHWVeN8d0IZ8v4_BW0alWkFAGj4rN2ysn8E0ZDXBxbf8AQdeNVhug9SYFKroTGS6Y2nev4ostsNgyf/s640/ldap-global-element.png&quot; width=&quot;636&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the picture of the Mule flow. The normal flow returns if the LDAP exists in the system. The exception flow is called when the lookup fails and the addition of LDAP user is executed.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguCm5la6oHWgv4z0FAbW1ROswNMm1aIRZyHprB59CdW66breOio5u1HI4Od1W_TqgKVpXmGsORAo4SRY-e4-EWPFrSGUavLueFfkiAt-vR-AvSXkrNRlHcBqc_vinMfMe58TU7yerspbwy/s1600/mule-flow.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;496&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguCm5la6oHWgv4z0FAbW1ROswNMm1aIRZyHprB59CdW66breOio5u1HI4Od1W_TqgKVpXmGsORAo4SRY-e4-EWPFrSGUavLueFfkiAt-vR-AvSXkrNRlHcBqc_vinMfMe58TU7yerspbwy/s640/mule-flow.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the Java code for the Java LDAP to Map transformer. This is for demo purpose so a lot of hard coded information is used,&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSCar6lwcg5atx-wcU6eIDxxm0HhXDGds6lQyB01dsaCBp2wzANwHW6bODo9QrM8FJXp9mNhIUA2j2gexIAMlAtLka7nPH3JtvOqY-Vhh3f4kXuPePmVRHMaBNIha4qaEkQQRnl3RFrA-I/s1600/java-ldap-map-transformer.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;406&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSCar6lwcg5atx-wcU6eIDxxm0HhXDGds6lQyB01dsaCBp2wzANwHW6bODo9QrM8FJXp9mNhIUA2j2gexIAMlAtLka7nPH3JtvOqY-Vhh3f4kXuPePmVRHMaBNIha4qaEkQQRnl3RFrA-I/s640/java-ldap-map-transformer.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To test this flow, enter the following URL,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
http://localhost:8082/ldap?dn=cn=ldapUser,ou=people,dc=example,dc=com&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This causes a new LDAP user to be created under ou=people,dc=example,dc=com.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We can verify this by looking at the Mule flow output,&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@1feed786.  
 log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@1feed786 class loader.  
 log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().  
 log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@1feed786.  
 log4j: Using URL [jar:file:/Users/legu/mule-resources/MuleStudio/plugins/org.mule.tooling.server.3.3.2.ee_1.3.2.201212121942/mule/tooling/tooling-support-3.3.1.jar!/log4j.properties] for automatic log4j configuration.  
 log4j: Reading configuration from URL jar:file:/Users/legu/mule-resources/MuleStudio/plugins/org.mule.tooling.server.3.3.2.ee_1.3.2.201212121942/mule/tooling/tooling-support-3.3.1.jar!/log4j.properties  
 log4j: Parsing for [root] with value=[INFO, console].  
 log4j: Level token is [INFO].  
 log4j: Category root set to INFO  
 log4j: Parsing appender named &quot;console&quot;.  
 log4j: Parsing layout options for &quot;console&quot;.  
 log4j: Setting property [conversionPattern] to [%-5p %d [%t] %c: %m%n].  
 log4j: End of parsing for &quot;console&quot;.  
 log4j: Parsed &quot;console&quot; options.  
 log4j: Parsing for [com.mycompany] with value=[DEBUG].  
 log4j: Level token is [DEBUG].  
 log4j: Category com.mycompany set to DEBUG  
 log4j: Handling log4j.additivity.com.mycompany=[null]  
 log4j: Parsing for [org.springframework.beans.factory] with value=[WARN].  
 log4j: Level token is [WARN].  
 log4j: Category org.springframework.beans.factory set to WARN  
 log4j: Handling log4j.additivity.org.springframework.beans.factory=[null]  
 log4j: Parsing for [org.apache] with value=[WARN].  
 log4j: Level token is [WARN].  
 log4j: Category org.apache set to WARN  
 log4j: Handling log4j.additivity.org.apache=[null]  
 log4j: Parsing for [org.mule] with value=[INFO].  
 log4j: Level token is [INFO].  
 log4j: Category org.mule set to INFO  
 log4j: Handling log4j.additivity.org.mule=[null]  
 log4j: Parsing for [org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog] with value=[ERROR].  
 log4j: Level token is [ERROR].  
 log4j: Category org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog set to ERROR  
 log4j: Handling log4j.additivity.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=[null]  
 log4j: Finished configuring.  
 INFO 2013-02-08 16:17:51,201 [main] org.mule.module.launcher.application.DefaultMuleApplication:   
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 + New app &#39;ldap_test&#39;                   +  
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 INFO 2013-02-08 16:17:51,203 [main] org.mule.module.launcher.application.DefaultMuleApplication:   
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 + Initializing app &#39;ldap_test&#39;               +  
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 INFO 2013-02-08 16:17:51,382 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker  
 INFO 2013-02-08 16:17:51,546 [main] org.mule.config.spring.MuleApplicationContext: Refreshing org.mule.config.spring.MuleApplicationContext@48ff4cf: startup date [Fri Feb 08 16:17:51 EST 2013]; root of context hierarchy  
 WARN 2013-02-08 16:17:52,585 [main] org.mule.config.spring.parsers.assembly.DefaultBeanAssembler: Cannot assign class java.lang.Object to interface org.mule.api.AnnotatedObject  
 INFO 2013-02-08 16:17:53,363 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising model: _muleSystemModel  
 WARN 2013-02-08 16:17:53,446 [main] org.springframework.beans.GenericTypeAwarePropertyDescriptor: Invalid JavaBean property &#39;port&#39; being accessed! Ambiguous write methods found next to actually used [public void org.mule.endpoint.URIBuilder.setPort(java.lang.String)]: [public void org.mule.endpoint.URIBuilder.setPort(int)]  
 INFO 2013-02-08 16:17:53,525 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising connector: connector.http.mule.default  
 INFO 2013-02-08 16:17:53,591 [main] org.mule.construct.FlowConstructLifecycleManager: Initialising flow: LDAP_ADD_IF_NOT_EXISTS  
 INFO 2013-02-08 16:17:53,591 [main] org.mule.exception.CatchMessagingExceptionStrategy: Initialising exception listener: org.mule.exception.CatchMessagingExceptionStrategy@4cfed6f7  
 INFO 2013-02-08 16:17:53,599 [main] org.mule.processor.SedaStageLifecycleManager: Initialising service: LDAP_ADD_IF_NOT_EXISTS.stage1  
 INFO 2013-02-08 16:17:53,610 [main] org.mule.config.builders.AutoConfigurationBuilder: Configured Mule using &quot;org.mule.config.spring.SpringXmlConfigurationBuilder&quot; with configuration resource(s): &quot;[ConfigResource{resourceName=&#39;/Users/legu/MuleStudio/workspace/.mule/apps/ldap_test/LDAP Create USER if not exist.xml&#39;}]&quot;  
 INFO 2013-02-08 16:17:53,610 [main] org.mule.config.builders.AutoConfigurationBuilder: Configured Mule using &quot;org.mule.config.builders.AutoConfigurationBuilder&quot; with configuration resource(s): &quot;[ConfigResource{resourceName=&#39;/Users/legu/MuleStudio/workspace/.mule/apps/ldap_test/LDAP Create USER if not exist.xml&#39;}]&quot;  
 INFO 2013-02-08 16:17:53,610 [main] org.mule.module.launcher.application.DefaultMuleApplication: Monitoring for hot-deployment: /Users/legu/MuleStudio/workspace/.mule/apps/ldap_test/LDAP Create USER if not exist.xml  
 INFO 2013-02-08 16:17:53,612 [main] org.mule.module.launcher.application.DefaultMuleApplication:   
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 + Starting app &#39;ldap_test&#39;                 +  
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 INFO 2013-02-08 16:17:53,619 [main] org.mule.util.queue.TransactionalQueueManager: Starting ResourceManager  
 INFO 2013-02-08 16:17:53,621 [main] org.mule.util.queue.TransactionalQueueManager: Started ResourceManager  
 INFO 2013-02-08 16:17:53,623 [main] org.mule.transport.http.HttpConnector: Connected: HttpConnector  
 {  
  name=connector.http.mule.default  
  lifecycle=initialise  
  this=12133926  
  numberOfConcurrentTransactedReceivers=4  
  createMultipleTransactedReceivers=true  
  connected=true  
  supportedProtocols=[http]  
  serviceOverrides=&amp;lt;none&amp;gt;  
 }  
 INFO 2013-02-08 16:17:53,623 [main] org.mule.transport.http.HttpConnector: Starting: HttpConnector  
 {  
  name=connector.http.mule.default  
  lifecycle=initialise  
  this=12133926  
  numberOfConcurrentTransactedReceivers=4  
  createMultipleTransactedReceivers=true  
  connected=true  
  supportedProtocols=[http]  
  serviceOverrides=&amp;lt;none&amp;gt;  
 }  
 INFO 2013-02-08 16:17:53,623 [main] org.mule.lifecycle.AbstractLifecycleManager: Starting connector: connector.http.mule.default  
 INFO 2013-02-08 16:17:53,626 [main] org.mule.module.ldap.agents.DefaultSplashScreenAgent:   
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 + DevKit Extensions (1) used in this application                +  
 + LDAP 1.0.1 (DevKit 3.3.1 Build UNNAMED.1297.150f2c9)+            +  
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 INFO 2013-02-08 16:17:53,627 [main] org.mule.lifecycle.AbstractLifecycleManager: Starting model: _muleSystemModel  
 INFO 2013-02-08 16:17:53,628 [main] org.mule.construct.FlowConstructLifecycleManager: Starting flow: LDAP_ADD_IF_NOT_EXISTS  
 INFO 2013-02-08 16:17:53,628 [main] org.mule.processor.SedaStageLifecycleManager: Starting service: LDAP_ADD_IF_NOT_EXISTS.stage1  
 INFO 2013-02-08 16:17:53,634 [main] org.mule.transport.http.HttpConnector: Registering listener: LDAP_ADD_IF_NOT_EXISTS on endpointUri: http://localhost:8082/ldap  
 INFO 2013-02-08 16:17:53,639 [main] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.http.transformers.MuleMessageToHttpResponse  
 INFO 2013-02-08 16:17:53,641 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising: &#39;null&#39;. Object is: HttpMessageReceiver  
 INFO 2013-02-08 16:17:53,646 [main] org.mule.transport.http.HttpMessageReceiver: Connecting clusterizable message receiver  
 INFO 2013-02-08 16:17:53,650 [main] org.mule.lifecycle.AbstractLifecycleManager: Starting: &#39;null&#39;. Object is: HttpMessageReceiver  
 INFO 2013-02-08 16:17:53,650 [main] org.mule.transport.http.HttpMessageReceiver: Starting clusterizable message receiver  
 INFO 2013-02-08 16:17:53,652 [main] org.mule.module.launcher.application.DefaultMuleApplication: Reload interval: 3000  
 INFO 2013-02-08 16:17:53,698 [main] org.mule.module.management.agent.WrapperManagerAgent: This JVM hasn&#39;t been launched by the wrapper, the agent will not run.  
 INFO 2013-02-08 16:17:53,731 [main] org.mule.module.management.agent.JmxAgent: Attempting to register service with name: Mule.ldap_test:type=Endpoint,service=&quot;LDAP_ADD_IF_NOT_EXISTS&quot;,connector=connector.http.mule.default,name=&quot;endpoint.http.localhost.8082.ldap&quot;  
 INFO 2013-02-08 16:17:53,732 [main] org.mule.module.management.agent.JmxAgent: Registered Endpoint Service with name: Mule.ldap_test:type=Endpoint,service=&quot;LDAP_ADD_IF_NOT_EXISTS&quot;,connector=connector.http.mule.default,name=&quot;endpoint.http.localhost.8082.ldap&quot;  
 INFO 2013-02-08 16:17:53,733 [main] org.mule.module.management.agent.JmxAgent: Registered Connector Service with name Mule.ldap_test:type=Connector,name=&quot;connector.http.mule.default.1&quot;  
 INFO 2013-02-08 16:17:53,735 [main] org.mule.DefaultMuleContext:   
 **********************************************************************  
 * Application: ldap_test                       *  
 * OS encoding: MacRoman, Mule encoding: UTF-8            *  
 *                                  *  
 * Agents Running:                          *  
 *  DevKit Extension Information                   *  
 *  Clustering Agent                         *  
 *  JMX Agent                            *  
 **********************************************************************  
 INFO 2013-02-08 16:17:53,736 [main] org.mule.module.launcher.DeploymentService:   
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 + Started app &#39;ldap_test&#39;                 +  
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 INFO 2013-02-08 16:18:29,991 [[ldap_test].connector.http.mule.default.receiver.02] org.mule.module.ldap.ldap.api.jndi.LDAPJNDIConnection: Binded to ldap://localhost with simple authentication as cn=admin,dc=example,dc=com  
 ERROR 2013-02-08 16:18:29,993 [[ldap_test].connector.http.mule.default.receiver.02] org.mule.module.ldap.ldap.api.jndi.LDAPJNDIConnection: Lookup failed.  
 javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name &#39;cn=ldapUser,ou=people,dc=example,dc=com&#39;  
      at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3092)  
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3013)  
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)  
      at com.sun.jndi.ldap.LdapCtx.c_getAttributes(LdapCtx.java:1312)  
      at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:213)  
      at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:121)  
      at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:109)  
      at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:123)  
      at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:118)  
      at org.mule.module.ldap.ldap.api.jndi.LDAPJNDIConnection.lookup(LDAPJNDIConnection.java:465)  
      at org.mule.module.ldap.LDAPConnector.lookup(LDAPConnector.java:480)  
      at org.mule.module.ldap.processors.LookupMessageProcessor$1.process(LookupMessageProcessor.java:130)  
      at org.mule.module.ldap.process.ProcessCallbackProcessInterceptor.execute(ProcessCallbackProcessInterceptor.java:18)  
      at org.mule.module.ldap.process.ManagedConnectionProcessInterceptor.execute(ManagedConnectionProcessInterceptor.java:63)  
      at org.mule.module.ldap.process.ManagedConnectionProcessInterceptor.execute(ManagedConnectionProcessInterceptor.java:21)  
      at org.mule.module.ldap.process.RetryProcessInterceptor.execute(RetryProcessInterceptor.java:68)  
      at org.mule.module.ldap.connectivity.ManagedConnectionProcessTemplate.execute(ManagedConnectionProcessTemplate.java:33)  
      at org.mule.module.ldap.processors.LookupMessageProcessor.process(LookupMessageProcessor.java:116)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)  
      at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:98)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)  
      at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)  
      at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105)  
      at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:102)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85)  
      at org.mule.construct.AbstractPipeline$3.process(AbstractPipeline.java:194)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.SimpleMessageProcessorChain.doProcess(SimpleMessageProcessorChain.java:47)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.SimpleMessageProcessorChain.doProcess(SimpleMessageProcessorChain.java:47)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57)  
      at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90)  
      at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)  
      at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46)  
      at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43)  
      at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85)  
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:220)  
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:202)  
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:194)  
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:181)  
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker$1.process(HttpMessageReceiver.java:311)  
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker$1.process(HttpMessageReceiver.java:306)  
      at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)  
      at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)  
      at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)  
      at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)  
      at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)  
      at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)  
      at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)  
      at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)  
      at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)  
      at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)  
      at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)  
      at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)  
      at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)  
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:305)  
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:251)  
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163)  
      at org.mule.work.WorkerContext.run(WorkerContext.java:311)  
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
      at java.lang.Thread.run(Thread.java:680)  
 ERROR 2013-02-08 16:18:30,001 [[ldap_test].connector.http.mule.default.receiver.02] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name &#39;cn=ldapUser,ou=people,dc=example,dc=com&#39;; resolved object com.sun.jndi.ldap.LdapCtx@c22b29a. Type: class javax.naming.NameNotFoundException  
 ERROR 2013-02-08 16:18:30,003 [[ldap_test].connector.http.mule.default.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy:   
 ********************************************************************************  
 Message        : Failed to invoke lookup. Message payload is of type: String  
 Code         : MULE_ERROR--2  
 --------------------------------------------------------------------------------  
 Exception stack is:  
 1. javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name &#39;cn=ldapUser,ou=people,dc=example,dc=com&#39;; resolved object com.sun.jndi.ldap.LdapCtx@c22b29a (javax.naming.NameNotFoundException)  
  com.sun.jndi.ldap.LdapCtx:3092 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/naming/NameNotFoundException.html)  
 2. [LDAP: error code 32 - No Such Object] (org.mule.module.ldap.ldap.api.NameNotFoundException)  
  sun.reflect.NativeConstructorAccessorImpl:-2 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/ldap/ldap/api/NameNotFoundException.html)  
 3. Failed to invoke lookup. Message payload is of type: String (org.mule.api.MessagingException)  
  org.mule.module.ldap.processors.LookupMessageProcessor:141 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)  
 --------------------------------------------------------------------------------  
 Root Exception stack trace:  
 javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name &#39;cn=ldapUser,ou=people,dc=example,dc=com&#39;  
      at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3092)  
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3013)  
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)  
   + 3 more (set debug level logging or &#39;-Dmule.verbose.exceptions=true&#39; for everything)  
 ********************************************************************************  
 INFO 2013-02-08 16:18:30,681 [[ldap_test].connector.http.mule.default.receiver.02] org.mule.module.ldap.LDAPConnector: Added entry cn=ldapUser,ou=people,dc=example,dc=com  
 INFO 2013-02-08 16:18:30,690 [[ldap_test].connector.http.mule.default.receiver.02] org.mule.api.processor.LoggerMessageProcessor: dn: cn=ldapUser,ou=people,dc=example,dc=com  
 sn: foobar  
 cn: foobar  
 objectClass: person  
&lt;/code&gt;&lt;/pre&gt;
Notice the NameNotFoundException block. This exception is handled by CatchExceptionStrategy and then the addition of LDAP is triggered.

Also we can verify this through a LDAP browser.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg77WoYWJI7fMcnmU6gdBkDESNOPFbXBkRLRh5SrPTQiy3PLQcyyCNgh1GD2dgM-Eiw9ifJRquiw3pn1I8tdJT5sRKJNT_4CqlE4JKnnf8rTuesKlUjpm-sXx2r5pWAPTKSCZlY9_PrU_6P/s1600/ldap-browser.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg77WoYWJI7fMcnmU6gdBkDESNOPFbXBkRLRh5SrPTQiy3PLQcyyCNgh1GD2dgM-Eiw9ifJRquiw3pn1I8tdJT5sRKJNT_4CqlE4JKnnf8rTuesKlUjpm-sXx2r5pWAPTKSCZlY9_PrU_6P/s640/ldap-browser.png&quot; width=&quot;590&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
This is just an extremely simple example and hopefully one gets the ideas of how easy and powerful Mule is to integrate with LDAP with minimum efforts.</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/1431990100498934993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2013/02/use-mule-ldap-connector-to-create-new.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1431990100498934993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1431990100498934993'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2013/02/use-mule-ldap-connector-to-create-new.html' title='Use Mule LDAP Connector to Create a New User'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzSarXaOF5M_kEa1bYx1SJqXWf9URQw8nHf-xaFInRixAHKOP-BStAORUnSxIAJ3C0hIZEZrLESCBv8hSfAQSKXi_ykM4OY3mtedx5QOWDwig-ig2eEm7AWeWDySTPhr6dsLTtaAKpkH-X/s72-c/install-ldap-connector.png" height="72" width="72"/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-4585720073365668029</id><published>2012-12-28T12:15:00.001-08:00</published><updated>2012-12-28T12:15:03.477-08:00</updated><title type='text'>Use Quartz Manager to monitor Quartz jobs inside Mule Studio</title><content type='html'>Now that we can successfully schedule jobs inside Mule Studio using Quartz, the next logical question is how we can monitor these jobs to know whether they executed or not, succeeded or failed? Mule does not provide monitoring at such a fine grained level. Luckily, Terracotta offers Mule Manager, as part of its Enterprise offering.&lt;br /&gt;
&lt;br /&gt;
One of the key challenges we need to solve is to provide in-depth monitoring capability for our next generation platform. Currently we use cron to schedule some of recurring jobs. While cron is easily to setup, it provides no visibility into if and when the job was executed, the status of the job execution (success, fail, or still ongoing).&lt;br /&gt;
&lt;br /&gt;
In this blog, we will show how to configure Mule Studio and Quartz connector so jobs can be monitored by Quartz manager.&lt;br /&gt;
&lt;br /&gt;
From Terracotta&#39;s web site,&lt;br /&gt;
&lt;br /&gt;
&quot;&lt;span style=&quot;background-color: #f9f9f9; color: #555555; font-family: HelveticaNeue, &#39;Helvetica Neue&#39;, Helvetica, Arial, &#39;Lucida Grande&#39;, sans-serif; font-size: 13px; line-height: 20px; text-align: left;&quot;&gt;Quartz Manager provides real-time monitoring and management for Quartz Scheduler. Use its rich graphical user interface to:&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;background-color: #f9f9f9; border: 0px; color: #555555; font-family: HelveticaNeue, &#39;Helvetica Neue&#39;, Helvetica, Arial, &#39;Lucida Grande&#39;, sans-serif; font-size: 13px; line-height: 1; margin: 0px 0px 18px 2em; padding: 0px; text-align: left;&quot;&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; line-height: 18px; margin: 0px 0px 0.5em; padding: 0px; text-align: left;&quot;&gt;Gain immediate visibility into job schedules, status and activity&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; line-height: 18px; margin: 0px 0px 0.5em; padding: 0px; text-align: left;&quot;&gt;Readily add or modify scheduling information&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; line-height: 18px; margin: 0px 0px 0.5em; padding: 0px; text-align: left;&quot;&gt;Manage multiple instances of Quartz Scheduler through a single interface&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; line-height: 18px; margin: 0px 0px 0.5em; padding: 0px; text-align: left;&quot;&gt;Simplify ongoing management of job scheduling and execution&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 0px; color: #555555; font-family: HelveticaNeue, &#39;Helvetica Neue&#39;, Helvetica, Arial, &#39;Lucida Grande&#39;, sans-serif; font-size: 13px; line-height: 20px; margin-bottom: 18px; padding: 0px; text-align: left;&quot;&gt;
Quartz Manager is an enterprise-grade addition to Quartz Scheduler that comes with a commercial license and support.&quot;&lt;/div&gt;
We really like the facts that Quartz monitoring is JMX based and Quartz manager works with existing Quartz schedule w/o any configuration changes, other than enabling JMX support.&lt;br /&gt;
&lt;br /&gt;
Here are the necessary steps to integrate Quartz end point with Quartz Manager.&lt;br /&gt;
&lt;h3&gt;
Download and Install Quartz Manager&lt;/h3&gt;
&lt;div&gt;
Follow the &lt;a href=&quot;http://terracotta.org/products/quartz-scheduler&quot;&gt;link&lt;/a&gt; to download and install Quartz Manager.&lt;/div&gt;
&lt;h3&gt;
Enable JMX for Quartz Connector inside Mule Studio&lt;/h3&gt;
&lt;div&gt;
Next we must enable JMX for both Quartz Connector and when we run the Mule flow.&lt;/div&gt;
&lt;h4&gt;
Enable JMX for Quartz Connector&lt;/h4&gt;
&lt;div&gt;
Enabling JMX for Quartz connector is accomplished through setting the following &quot;quartz:factory-property&quot; entries,&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.jmx.export&quot;  
                value=&quot;true&quot; /&amp;gt;  
 &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.jmx.objectName&quot;  
                value=&quot;quartz:type=QuartzScheduler,name=JmxScheduler,instanceId=NONE_CLUSTERED&quot; /&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Replace &lt;span style=&quot;background-color: #f0f0f0; line-height: 20px; text-align: left;&quot;&gt;org.quartz.scheduler.jmx.objectName&#39;s name and instanceId with one&#39;s own appropriate values.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h4&gt;
&lt;span style=&quot;background-color: #f0f0f0; line-height: 20px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Enable JMX Remoting when Running Mule Flow&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f0f0f0; line-height: 20px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;Now we need to enable JMX remoting when running Mule Flow. Go to eclipse-&amp;gt;Run-&amp;gt;Run Configuration. Find the run configuration for the existing flow under &quot;Mule Application&quot;. Add the following entries to VM arguments,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; -XX:PermSize=128M -XX:MaxPermSize=256M -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;
Upgrade Quartz JAR File in Mule Studio&lt;/h3&gt;
&lt;div&gt;
Next we need to upgrade the quartz-all.jar file shipped with Mule Enterprise Studio. Currently Mule ships quartz-all-1.6.6.jar, which is very old and won&#39;t work with Quartz manager. We can&#39;t use the most recently release of Quartz as the most recent version breaks the backward compatibility and Mule won&#39;t support it. Download quartz-all-1.8.6.jar from Terrocatta&#39;s web site.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Go to MuleStudio installation directory and replace quartz-all-1.6.6.jar with quartz-all-1.8.6.jar.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
We also need to fix the built-in Mule runtime libraries reference to quartz-all-1.6.6.jar with quartz-all-1.8.6.jar. Mule runtime dependency is defined in a MANIFEST.MF file under your Mule studio installation directory. Locate this file, replace quartz-all-1.6.6.jar with quartz-all-1.8.6.jar.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Start Mule Flow and Quartz Manager&lt;/h3&gt;
&lt;div&gt;
Now we can start Mule Flow and Quartz Manager.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When Quartz Manager first starts up, it asks for JMX host and port number,&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJzYfoQ-6Oa6a69tAEK1ErqXsPpluLH7q64ifTD3MEsTWwGeFka-qMY1tyewNdKzjwkXwVDbuiN5iXMuJeZQ9DciHQo5BLNDOMcKXcKR7jFju-juGYyuB4plfHs4pvTGka9HAOwKN6C65f/s1600/quartz-manager-jmx-connect.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;522&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJzYfoQ-6Oa6a69tAEK1ErqXsPpluLH7q64ifTD3MEsTWwGeFka-qMY1tyewNdKzjwkXwVDbuiN5iXMuJeZQ9DciHQo5BLNDOMcKXcKR7jFju-juGYyuB4plfHs4pvTGka9HAOwKN6C65f/s640/quartz-manager-jmx-connect.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Enter the correct host name and port number.&lt;br /&gt;
&lt;br /&gt;
After successfully connecting to the remote Quartz scheduler, Quartz manager display the following job details page,&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg1_vvKAEj0K61lODD1vF7tlE8ZA7jLXBapZ2SNVOBYKJfw5frAWh22ysl7J3bO9cg9g6nOf9dAlp-uuY0v7trkUyonMrbduFJX9iZURUbG0ovJrB8NqdmvtDmkME-tbeleBzsBS31WAl3/s1600/quartz-manager-job.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;450&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg1_vvKAEj0K61lODD1vF7tlE8ZA7jLXBapZ2SNVOBYKJfw5frAWh22ysl7J3bO9cg9g6nOf9dAlp-uuY0v7trkUyonMrbduFJX9iZURUbG0ovJrB8NqdmvtDmkME-tbeleBzsBS31WAl3/s640/quartz-manager-job.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Click on &quot;Triggers&quot; to show trigger details.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb5MTMmajk4H9-vmYiH9pgyKqDss1Gia-ihxNk3xDipyqul3dvL-foZsFRiZLvY3iZ2ZiWRwZuAwnh0zDzOF1x6UxRdX1tAQW6b-HAJSdGtUh7NYU_fOl3McttXcEpMrVKKkxsFK8IpFA4/s1600/quartz-manager-trigger.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb5MTMmajk4H9-vmYiH9pgyKqDss1Gia-ihxNk3xDipyqul3dvL-foZsFRiZLvY3iZ2ZiWRwZuAwnh0zDzOF1x6UxRdX1tAQW6b-HAJSdGtUh7NYU_fOl3McttXcEpMrVKKkxsFK8IpFA4/s640/quartz-manager-trigger.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Click on &quot;Job Monitor&quot; to see the detailed status for each executed job.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNcIhZ-tGgXUGAz3CAN3H7cRvzCQP281fKBV_Ukn49MUwiqXcON1za4eSaFfgBV8xgv_HvJRduOOMmiR-qdgX6edGY10ksm_c48cmu3BFOYBJxrPQEiBc6kFL-__MhW4yEM3xbId0n_Ved/s1600/quartz-manager-job-monitoring.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;410&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNcIhZ-tGgXUGAz3CAN3H7cRvzCQP281fKBV_Ukn49MUwiqXcON1za4eSaFfgBV8xgv_HvJRduOOMmiR-qdgX6edGY10ksm_c48cmu3BFOYBJxrPQEiBc6kFL-__MhW4yEM3xbId0n_Ved/s640/quartz-manager-job-monitoring.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/4585720073365668029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/12/use-quartz-manager-to-monitor-quartz.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/4585720073365668029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/4585720073365668029'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/12/use-quartz-manager-to-monitor-quartz.html' title='Use Quartz Manager to monitor Quartz jobs inside Mule Studio'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJzYfoQ-6Oa6a69tAEK1ErqXsPpluLH7q64ifTD3MEsTWwGeFka-qMY1tyewNdKzjwkXwVDbuiN5iXMuJeZQ9DciHQo5BLNDOMcKXcKR7jFju-juGYyuB4plfHs4pvTGka9HAOwKN6C65f/s72-c/quartz-manager-jmx-connect.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-1456696475120814796</id><published>2012-12-27T17:47:00.002-08:00</published><updated>2012-12-27T17:49:14.782-08:00</updated><title type='text'>Schedule Jobs using Mule Studio and Quartz, part II</title><content type='html'>In the previous blog, we discuss how to use inbound Quartz end point to trigger jobs. In this blog, we discuss how to use outbound Quartz end point to schedule jobs when some external events happen.&lt;br /&gt;
&lt;br /&gt;
Below is the sample Mule flow. When someone accesses the HTTP end point, a message is put on a VM end point, which triggers Quartz Scheduler to run a job that put a message on a different VM end point, which gets picked up by Java transformer that will process it eventually.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL6awKwKxt6mTFM3R9pgzNGZP4hdgnFJ0DozqBi4iCNVt1ukjHYnDGvsbdApy7pa6cBtZQ7pX-WAneJwrAmpTAiiXuupafIOqYxUesBhlIkHQlkNtWgCaM6MXSL0CciEHJQr6CJdR5GgHf/s1600/schedule-event-flow.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL6awKwKxt6mTFM3R9pgzNGZP4hdgnFJ0DozqBi4iCNVt1ukjHYnDGvsbdApy7pa6cBtZQ7pX-WAneJwrAmpTAiiXuupafIOqYxUesBhlIkHQlkNtWgCaM6MXSL0CciEHJQr6CJdR5GgHf/s1600/schedule-event-flow.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&amp;nbsp;Pay attention to the key difference between this flow and the inbound end point flow. In the inbound end point flow, there is no message following into the inbound end point. For the outbound event, a message (VM or JMS) is necessary to trigger the job.&lt;br /&gt;
&lt;br /&gt;
Double click on the outbound end point and the following window shows up,&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUUYhM-173SpR0VOXts5HK3oA0U0oT3DKaA8s9BPXfFgsEnieF0V3Olq0S2ejX76JLp2JWIixhafenl64Cc5iPDRodZKC9Mi65XV7lo7pShJHG5gec6iqLG-ydsiLsQJLg7IvGZFotj3S1/s1600/schedule-event-quartz.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUUYhM-173SpR0VOXts5HK3oA0U0oT3DKaA8s9BPXfFgsEnieF0V3Olq0S2ejX76JLp2JWIixhafenl64Cc5iPDRodZKC9Mi65XV7lo7pShJHG5gec6iqLG-ydsiLsQJLg7IvGZFotj3S1/s1600/schedule-event-quartz.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Fill in the necessary scheduling information and click on plus sign to add a new job.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij4bM-K_lwGdk8H2ciCMfBmEx2qTsUtqk_KSypkNO8GEozpjgYIJQWf7QEG_RV1_EcpxQAD6fAQCWb38jL-ast_UluF4Aw0TBO5jybdQCXDOtTmNjhGhv4FtTvPLEG7zjbOyKQnOo51dH_/s1600/schedule-event-pick-job-type.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;600&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij4bM-K_lwGdk8H2ciCMfBmEx2qTsUtqk_KSypkNO8GEozpjgYIJQWf7QEG_RV1_EcpxQAD6fAQCWb38jL-ast_UluF4Aw0TBO5jybdQCXDOtTmNjhGhv4FtTvPLEG7zjbOyKQnOo51dH_/s640/schedule-event-pick-job-type.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure we select &quot;quartz:schedule-dispatch-job&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggQZyk_z4n5-kydEHshMCCDUZKnXkWtDG6n3H6GLz_tKNaInPLgIDic-t9a0SbrQvSi1vcg4ZE2syRO8og4E_6J24sSrX-RhnkcHIXXQ_7cPtIZajhK-vOMmkVRpy_qTImc1Oj7jJNe4M5/s1600/schedule-event-pick-endpoint.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggQZyk_z4n5-kydEHshMCCDUZKnXkWtDG6n3H6GLz_tKNaInPLgIDic-t9a0SbrQvSi1vcg4ZE2syRO8og4E_6J24sSrX-RhnkcHIXXQ_7cPtIZajhK-vOMmkVRpy_qTImc1Oj7jJNe4M5/s640/schedule-event-pick-endpoint.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;Make sure &quot;Group Name:&quot;, &quot;Job Group Name:&quot;, and &quot;Address:&quot; are not filled in at all. If they are filled in, one will get some weird error that can&#39;t be made any sense of. I wish Mule Studio can be more helpful but it doesn&#39;t. I finally resolved this issue after spending hours searching and googling.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;
That&#39;s it. Now execute the flow and access the HTTP end point. You will see our Java transformer gets executed twice after initial delay of 15 seconds.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/1456696475120814796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/12/how-to-schedule-jobs-using-mule-and.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1456696475120814796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1456696475120814796'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/12/how-to-schedule-jobs-using-mule-and.html' title='Schedule Jobs using Mule Studio and Quartz, part II'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL6awKwKxt6mTFM3R9pgzNGZP4hdgnFJ0DozqBi4iCNVt1ukjHYnDGvsbdApy7pa6cBtZQ7pX-WAneJwrAmpTAiiXuupafIOqYxUesBhlIkHQlkNtWgCaM6MXSL0CciEHJQr6CJdR5GgHf/s72-c/schedule-event-flow.png" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-2274372885418619564</id><published>2012-12-27T14:21:00.000-08:00</published><updated>2012-12-27T17:49:24.810-08:00</updated><title type='text'>Schedule Jobs using Mule Studio and Quartz, Part I</title><content type='html'>There are a lot of confusions in how to use Quartz to schedule jobs inside Mule Studio. The documentation is slim to none.&lt;br /&gt;
In this series of blogs, we attempt to explain and show how to use Quartz to schedule both inbound and outbound jobs, and how to enable Mule Quartz connector so we can use Quartz manager to monitor jobs.&lt;br /&gt;
&lt;br /&gt;
For Mule&#39;s reference, &quot;&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19px;&quot;&gt;The Quartz transport provides support for scheduling events and for triggering new events. An inbound quartz endpoint can be used to trigger inbound events that can be repeated, such as every second. Outbound quartz endpoints can be used to schedule an existing event to fire at a later date. Users can create schedules using cron expressions, and events can be persisted in a database.&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
An inbound quartz endpoint is used when we need to trigger inbound events periodically, like generating a predefined message, or loading a file, and then pass the generated message down the flow, either directly or through a VM or JMS.&lt;br /&gt;
&lt;br /&gt;
An outbound quartz endpoint is used when we need to trigger an event based on incoming events. For example, in our world, we want to send all users a 25% off coupon everyday at 9am, for all the users who click on the welcome link embedded in our email campaign for the previous day.&lt;br /&gt;
&lt;br /&gt;
The key difference between the inbound and outbound endpoint is that inbound message is scheduled entirely by Quartz, while the outbound endpoint is scheduled by Quartz, but only after an incoming event has been triggered. We will use some examples to illustrate the key differences.&lt;br /&gt;
&lt;h3&gt;
Quartz Connector&lt;/h3&gt;
But before we dive into the nitty gritty details, we need to create a Mule Quartz connector first. A Mule Quartz connector is how a Quartz schedule should be created by Mule.&lt;br /&gt;
&lt;br /&gt;
Here is a sample scheduler using RAMJobStore. Enter the following block of xml in Mule flow&#39;s configuration XML section.&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;   &amp;lt;quartz:connector name=&quot;quartzConnector_vm&quot; validateConnections=&quot;true&quot; doc:name=&quot;Quartz&quot;&amp;gt;  
     &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.instanceName&quot; value=&quot;MuleScheduler1&quot;/&amp;gt;  
     &amp;lt;quartz:factory-property key=&quot;org.quartz.threadPool.class&quot; value=&quot;org.quartz.simpl.SimpleThreadPool&quot;/&amp;gt;  
     &amp;lt;quartz:factory-property key=&quot;org.quartz.threadPool.threadCount&quot; value=&quot;3&quot;/&amp;gt;  
     &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.rmi.proxy&quot; value=&quot;false&quot;/&amp;gt;  
     &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.rmi.export&quot; value=&quot;false&quot;/&amp;gt;  
     &amp;lt;quartz:factory-property key=&quot;org.quartz.jobStore.class&quot; value=&quot;org.quartz.simpl.RAMJobStore&quot;/&amp;gt;  
   &amp;lt;/quartz:connector&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Mule uses &quot;quartz:factory-property&quot; to specify all Quartz related properties.&lt;br /&gt;
&lt;br /&gt;
Here is how to configure a clustered scheduler using a JDBCJobStore using MySQL.&amp;nbsp;Enter the following block of xml in Mule flow&#39;s configuration XML section.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;      &amp;lt;quartz:connector name=&quot;quartzConnector_vm&quot;  
           validateConnections=&quot;true&quot; doc:name=&quot;Quartz&quot;&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.instanceName&quot;  
                value=&quot;JmxScheduler&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.instanceId&quot;  
                value=&quot;_CLUSTERED&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.jobStore.isClustered&quot; value=&quot;true&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.jobFactory.class&quot;  
                value=&quot;org.quartz.simpl.SimpleJobFactory&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.threadPool.class&quot;  
                value=&quot;org.quartz.simpl.SimpleThreadPool&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.threadPool.threadCount&quot;  
                value=&quot;3&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.rmi.proxy&quot;  
                value=&quot;false&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.rmi.export&quot;  
                value=&quot;false&quot; /&amp;gt;  
           &amp;lt;!-- JDBC JOB STORE --&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.jobStore.class&quot;  
                value=&quot;org.quartz.impl.jdbcjobstore.JobStoreTX&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.jobStore.driverDelegateClass&quot;  
                value=&quot;org.quartz.impl.jdbcjobstore.StdJDBCDelegate&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.jobStore.dataSource&quot;  
                value=&quot;quartzDataSource&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.jobStore.tablePrefix&quot;  
                value=&quot;QRTZ_&quot; /&amp;gt;  
           &amp;lt;!-- MYSQL Data Source --&amp;gt;  
           &amp;lt;quartz:factory-property  
                key=&quot;org.quartz.dataSource.quartzDataSource.driver&quot; value=&quot;com.mysql.jdbc.Driver&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.dataSource.quartzDataSource.URL&quot;  
                value=&quot;jdbc:mysql://localhost:3306/quartz2&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.dataSource.quartzDataSource.user&quot;  
                value=&quot;root&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property  
                key=&quot;org.quartz.dataSource.quartzDataSource.password&quot; value=&quot;root&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property  
                key=&quot;org.quartz.dataSource.quartzDataSource.maxConnections&quot; value=&quot;8&quot; /&amp;gt;  
           &amp;lt;!-- JMX Enable --&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.jmx.export&quot;  
                value=&quot;true&quot; /&amp;gt;  
           &amp;lt;quartz:factory-property key=&quot;org.quartz.scheduler.jmx.objectName&quot;  
                value=&quot;quartz:type=QuartzScheduler,name=JmxScheduler,instanceId=NONE_CLUSTERED&quot; /&amp;gt;  
      &amp;lt;/quartz:connector&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
To verify that the Quartz connector has been configured successfully, go the &quot;Global Elements&quot; in the Mule flow.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdv9sF-5DtItH5t0BWSfmejKz34SPril_Nm3-bkD1XJLOC1ltGCu8hirq2ev5G1xLBUYWlNzcr5D2iCAeIrdMnn_XgxG8wOzmUKg4qBLjcjTS0k_Nt1rIs0F6F5cZjpxA5EZMqJ-HA_Bma/s1600/define-quartz-connector.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;498&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdv9sF-5DtItH5t0BWSfmejKz34SPril_Nm3-bkD1XJLOC1ltGCu8hirq2ev5G1xLBUYWlNzcr5D2iCAeIrdMnn_XgxG8wOzmUKg4qBLjcjTS0k_Nt1rIs0F6F5cZjpxA5EZMqJ-HA_Bma/s640/define-quartz-connector.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
Click on Quartz.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8vh5m_uTrvcmjeT5jWh5lNdGqiX2LMM89WmVvxBdMhoVvOpUD36XQ5FEkfRCpySzHO7Bqx5qVDz4iDluw2QxD_U6jMgYXhj_73FWV7Nu24sktzTT8m1m8eqPUvmNdjo4vBwaH-wsuQOPc/s1600/quartz-connector.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8vh5m_uTrvcmjeT5jWh5lNdGqiX2LMM89WmVvxBdMhoVvOpUD36XQ5FEkfRCpySzHO7Bqx5qVDz4iDluw2QxD_U6jMgYXhj_73FWV7Nu24sktzTT8m1m8eqPUvmNdjo4vBwaH-wsuQOPc/s640/quartz-connector.png&quot; width=&quot;630&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;/h3&gt;
Click on &quot;Properties&quot; tab,&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzSMubc11ZLPDvWwk7DxyRfmlSh4b71KL9LiRe4GbUd5V0HTSYKxeQN0czrxDHc_AlRLaERgAqc3dmyCgD-H-BWqPiXzTkP0lEBKz95lfWRKs5s2ym-FRV7K-zVAzyblSCI64ab2cXPGKb/s1600/quartz-connector-details.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzSMubc11ZLPDvWwk7DxyRfmlSh4b71KL9LiRe4GbUd5V0HTSYKxeQN0czrxDHc_AlRLaERgAqc3dmyCgD-H-BWqPiXzTkP0lEBKz95lfWRKs5s2ym-FRV7K-zVAzyblSCI64ab2cXPGKb/s320/quartz-connector-details.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Verify all Quartz properties have been properly configured.&lt;br /&gt;
&lt;h3&gt;
Use Inbound Quartz End Point&lt;/h3&gt;
&lt;div&gt;
An inbound quartz end point is self-triggered and will generate one or more messages, whose payload can be preconfigured or reloaded from a file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the picture of the sample Mule Flow. Every 5 seconds, Quartz end point will generate a VM message containing &quot;HELLO!&#39; as its body. We have a Java transform that listens to the same VM end point and processes the generated &quot;HELLO!&quot; message.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW_f426BVdiZzd3k6ZMCwlt7XBWXAsgl_Sdo1V5Sd48Oah4qCM23pFyYRuWPiZAqPyOjs5ycd9dsc0rZU4OUMZL8BSO9yMWRevPrF7moENyx0tXinSDe9YYSvn-sGkdGf9uSSu-xCgMeUW/s1600/event-gnerate-mule-flow.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW_f426BVdiZzd3k6ZMCwlt7XBWXAsgl_Sdo1V5Sd48Oah4qCM23pFyYRuWPiZAqPyOjs5ycd9dsc0rZU4OUMZL8BSO9yMWRevPrF7moENyx0tXinSDe9YYSvn-sGkdGf9uSSu-xCgMeUW/s1600/event-gnerate-mule-flow.png&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW_f426BVdiZzd3k6ZMCwlt7XBWXAsgl_Sdo1V5Sd48Oah4qCM23pFyYRuWPiZAqPyOjs5ycd9dsc0rZU4OUMZL8BSO9yMWRevPrF7moENyx0tXinSDe9YYSvn-sGkdGf9uSSu-xCgMeUW/s1600/event-gnerate-mule-flow.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Double click on &quot;Quartz_Event_Generator&quot; and it brings up the Quartz Mule component,&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkdaNUzksZKYKmRoUbk7EZvIlmLRftcV8NbX8RE6K6d8dQYxmRiD9K8LGv4AOraDCp-hZTSClWYOlJ-p7DYlV97iTRgSIZFxfMBJN3qYcoCNDzAWRLRfrchQoPA1IU0hIF_Z4cslzDQjBT/s1600/+event-generator-add-job.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkdaNUzksZKYKmRoUbk7EZvIlmLRftcV8NbX8RE6K6d8dQYxmRiD9K8LGv4AOraDCp-hZTSClWYOlJ-p7DYlV97iTRgSIZFxfMBJN3qYcoCNDzAWRLRfrchQoPA1IU0hIF_Z4cslzDQjBT/s1600/+event-generator-add-job.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Fill in the desired information so that our job will fire every five seconds. Now we need to add a new job. Click on plus sign.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5zA2vXeJvx9XnzpCnZ6PzpiaXc_jMwV6ibm2kgC68ozX5rJvv1-5fGlZ5UjExW76PrXjGImCwFpEqCwpgCVpsFr8IbaoNVcyj6mOtXE-Npuuj1IIdlHsiPtklFbqDm1hNuysF_dsfqlJg/s1600/pick-job-type.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;596&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5zA2vXeJvx9XnzpCnZ6PzpiaXc_jMwV6ibm2kgC68ozX5rJvv1-5fGlZ5UjExW76PrXjGImCwFpEqCwpgCVpsFr8IbaoNVcyj6mOtXE-Npuuj1IIdlHsiPtklFbqDm1hNuysF_dsfqlJg/s640/pick-job-type.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Select &quot;quartz:event-generator-job&quot; and click on &quot;Next&quot;.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzh9Mxi-SMYt3H_Haqc4Bahnhnfd4AdMPfBlQF5O-Lor8b0sii3eBBwOhBVZ_fM2vIbf9kdz4BJPVZtPLyoiz7RAsZ7FYzf_LpF_5UQuAsRu7t9d90UTLUE4o858c-iecn3Q8RvMTkrlnX/s1600/event-generator-details.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;597&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzh9Mxi-SMYt3H_Haqc4Bahnhnfd4AdMPfBlQF5O-Lor8b0sii3eBBwOhBVZ_fM2vIbf9kdz4BJPVZtPLyoiz7RAsZ7FYzf_LpF_5UQuAsRu7t9d90UTLUE4o858c-iecn3Q8RvMTkrlnX/s640/event-generator-details.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Fill in &quot;Group Name&quot;, &quot;Job Group Name&quot;, and enter &quot;HELLO!&quot; for Text. We can also click on &quot;...&quot; next to File to load the file as the message payload.&lt;br /&gt;
&lt;br /&gt;
Now we need to select our already defined quartz connector by clicking on the &quot;References&quot; tag on the Quartz component and select the appropriate pre-defined quartz connector from the drop down list for &quot;Connector Reference:&quot; field.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjULz0OCTYpW0dw8iwHKtkZ1FD1wrnw98NQaN2BZtxnXfXi8QnDHtgHlX7fHhmPwN_uF5HXMyDHNWGr1LS-KJmNyBRvbcJ2B5PNMNQCIvWBpZ0DZmRgHyuYw2nCiKFCXs1cHncADIxDcrjy/s1600/select-quartz-connector.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjULz0OCTYpW0dw8iwHKtkZ1FD1wrnw98NQaN2BZtxnXfXi8QnDHtgHlX7fHhmPwN_uF5HXMyDHNWGr1LS-KJmNyBRvbcJ2B5PNMNQCIvWBpZ0DZmRgHyuYw2nCiKFCXs1cHncADIxDcrjy/s640/select-quartz-connector.png&quot; width=&quot;634&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Now we can run our Mule to verify that Quartz will trigger a message very five seconds and the message will be processed by our Java transformer.&lt;br /&gt;
&lt;br /&gt;
We will discuss Quartz outbound events in the next blog.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/2274372885418619564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/12/how-to-schedule-jobs-using-mule-studio.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/2274372885418619564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/2274372885418619564'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/12/how-to-schedule-jobs-using-mule-studio.html' title='Schedule Jobs using Mule Studio and Quartz, Part I'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdv9sF-5DtItH5t0BWSfmejKz34SPril_Nm3-bkD1XJLOC1ltGCu8hirq2ev5G1xLBUYWlNzcr5D2iCAeIrdMnn_XgxG8wOzmUKg4qBLjcjTS0k_Nt1rIs0F6F5cZjpxA5EZMqJ-HA_Bma/s72-c/define-quartz-connector.png" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-7549884509340998105</id><published>2012-09-24T13:46:00.002-07:00</published><updated>2012-09-24T13:46:38.463-07:00</updated><title type='text'>Riak Cluster, Sanity Check, Part Two</title><content type='html'>In this blog, we continued with our sanity check on Riak Cluster.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Setting up Riak Cluster&lt;/h3&gt;
&lt;div&gt;
I have used HBase, Cassandra, MongoDB in the past and I was preparing for a long,&amp;nbsp;laborious&amp;nbsp;efforts to setup a five-node Riak cluster but I was pleasantly surprised on how easy it was to set up the cluster. I found the command line tools are extremely helpful at diagnosing the cluster status, etc.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Sanity Check&lt;/h3&gt;
&lt;div&gt;
Our sanity check consists of loading 20 million objects in the cluster and executes a series of Get, link walking, and free text search over 10 concurrent threads, while physical nodes are brought down and brought back up in the middle of performance testing.&lt;/div&gt;
&lt;h3&gt;
Use HA Proxy for load balancing and failover&lt;/h3&gt;
&lt;div&gt;
We couldn&#39;t get Java client&#39;s cluster client to work for us so we switch to use HA proxy for failover and load balancing purpose and it works out really well for us.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When we brought down a Riak node during the performance testing, some of the in-flight queries failed but succeeded immediately after we retried with the same method call.&lt;/div&gt;
&lt;h3&gt;
Test Result&lt;/h3&gt;
&lt;div&gt;
Our sanity check performed flawless when physical nodes were brought down during the testing. Inflight queries failed but recovered right after we retried with the same query and there is little degradation when losing a physical node.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
However, a big surprise came when we brought a physical node backup during the performance testing. It increased the overall performance time by 6 times. Baffled, I reached out to Brian at Basho and there is his explanation,&lt;/div&gt;
&lt;div&gt;
&quot;The reason I ask is the http/pb API listener will start up before Riak KV has finished starting. So, while these nodes will be available for requests they will be slow and build up queues as they start up needed resources. You can use the riak-admin wait-for-service riak_kv &amp;lt;nodename&amp;gt; command from any other node to check if riak_kv is up.&quot;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
My follow-on question,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&quot;Yes, I have my performance test running, through a HA proxy that maps to 5 nodes. I understand that the initial response from the starting up node will be slow, but it is impacting the entire performance, which consists of 10 testing threads. I would rather have the node not accepting request until it is ready than accepting requests but queuing them up to drag down the cluster performance.&quot;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
And Brian&#39;s response,&lt;/div&gt;
&lt;div&gt;
&quot;I completely agree, there is currently work being done on separating the startup into two separate processes. One which will reply with 503 to all requests and then dies when KV is started and ready to take requests. Currently, even if a request is not sent to a node directly, in the case of a PUT, the data will be forwarded to the node even though KV is not ready to accept it. Depending on your W quorum this could result in a long response time for requests as the coordinating node waits for a response from the starting up node. &amp;nbsp;Currently there is no method to make a node &#39;invisible&#39; to other nodes in the cluster without bringing it down or changing the cookie in vm.args.&quot;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Summary&lt;/h3&gt;
We are pleased with our overall sanity check results but there are definitely kinks need to be worked out and I am glad Riak team is on top of things.&lt;br /&gt;
























</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/7549884509340998105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/09/riak-cluster-sanity-check-part-two.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/7549884509340998105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/7549884509340998105'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/09/riak-cluster-sanity-check-part-two.html' title='Riak Cluster, Sanity Check, Part Two'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-3695367531366235707</id><published>2012-09-24T13:27:00.000-07:00</published><updated>2012-09-24T13:27:03.914-07:00</updated><title type='text'>Riak Sanity Check, Take One</title><content type='html'>Before we can officially recommend Riak to the management team, we executed a series of sanity checks to make sure that we will make a sound recommendation and won&#39;t come back and bite us in the rear.&lt;br /&gt;
&lt;h3&gt;
Testing Scenario&lt;/h3&gt;
Our sanity testing environment consists of 20 million objects, running on a single physics node. After 20 million objects are loaded into the Riak 1.1, we executed a series of get, link walking, and free text search with 10 concurrent threads.&lt;br /&gt;
&lt;br /&gt;
We are not interested in the actual performance number, but are looking for obvious bottlenecks and abnormal behaviors.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Test Result&lt;/h3&gt;
&lt;div&gt;
We are surprised at the poor results exhibit by our sanity checks, Riak consuming 100% of CPU and 75% of memory and queries didn&#39;t return in any reasonable fashion.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Needless to say, we are somewhat concerned. This is where Riak&#39;s excellent support jumps into the play. Riak&#39;s Develop Advocate Brian worked with us and came up with an excellent diagnosis;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&quot;LevelDB holds data in a &quot;young level&quot; before compacting this data into numbered levels (Level0, Level1, Level2….) who&#39;s maximum space grow as their number iterates. In pre Riak 1.2 levelDB, the compaction operation from the young level to sorted string table&#39;s was a blocking operation. Compaction and read operations used the same scheduler thread to do their work so if a compaction operation was occurring that partition would be effectively locked. Riak 1.2 moves compaction off onto it&#39;s own scheduler thread so the vnode_worker (who is responsible for GET/PUT operations) will not be waiting for compaction to complete before read requested can be serviced by the levelDB backend (write requests are dropped in the write buffer, independent of compaction).&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
In your scenario, the bulk load operation caused a massive amount of compaction. Most likely, because of the large amount of objects you loaded, there was compaction occurring on all 64 partitions for a while after your write operation completed. The input data sat in the write buffer and young level and eventually compaction moved them to their appropriate levels but during this time read operations will timeout. &amp;nbsp;&quot;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
So our bulk loading led to a contention on a single thread, which is responsible for compacting and querying at the same time.&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
We can&#39;t upgrade to 1.2 just yet because a bug in search so we will have to wait for the next release.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Summary&lt;/h3&gt;
&lt;div&gt;
Overall we are not pleased with our sanity checks but am satisfied with the explanation.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/3695367531366235707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/09/riak-sanity-check-take-one.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/3695367531366235707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/3695367531366235707'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/09/riak-sanity-check-take-one.html' title='Riak Sanity Check, Take One'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-6006255150025602454</id><published>2012-08-23T12:12:00.000-07:00</published><updated>2012-09-12T08:54:55.987-07:00</updated><title type='text'>Riak HTTP API Cheat Sheet</title><content type='html'>&lt;h2&gt;
Riak HTTP API Cheat Sheet&lt;/h2&gt;
&lt;div&gt;
&lt;h4&gt;
Listing Buckets and Keys&lt;/h4&gt;
To list all buckets,&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; http://localhost:8098/buckets?buckets=true  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
To list all keys within a particular bucket,&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; http://localhost:8098/buckets/bucket-name/keys?keys=true  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
To list a single object based on key,&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; http://localhost:8098/buckets/bucket-name/keys/key-value  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h4&gt;
Secondary Index&lt;/h4&gt;
To find an object based on secondary index,&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; http://localhost:8098/buckets/bucket-name/index/index-name_bin/index-value  &lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;
Link Walking&amp;nbsp;&lt;/h4&gt;
To walk a link from a source key,&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; curl -v http://localhost:8098/riak/bucket-name/key-value/_,link-name,1/_,link-name,1  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The walk result provides the interesting results, including secondary index and links on the return objects.&lt;br /&gt;
&lt;pre style=&quot;background-color: #f0f0f0; background-position: initial initial; background-repeat: initial initial; border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; --AZBlFqksfFqU1it69r5Ygf99o0p  
 X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvrf7r6bwZTInMfKMOXIypN8WQA=  
 Location: /riak/schema_schema2/campaigns-efg  
 Content-Type: application/json; charset=UTF-8  
 &lt;/code&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;Link: &amp;lt;/riak/schema_schema2/folder%3Acampaigns-folder1&amp;gt;; riaktag=&quot;PARENT&quot;, &amp;lt;/riak/schema_schema2&amp;gt;; rel=&quot;up&quot;&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  
 Etag: 4qk1erJBcxtRZxJBDFgxK3  
 Last-Modified: Wed, 22 Aug 2012 21:01:08 GMT  
 &lt;/code&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;x-riak-index-uri_bin: _schemas_schema2_campaigns_campaigns-efg&lt;/b&gt;&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  
 {&quot;bucket&quot;:&quot;schema_schema2&quot;,&quot;contextType&quot;:&quot;CAMPAIGN&quot;,&quot;json&quot;:{&quot;name&quot;:&quot;campaigns-efg&quot;,&quot;id&quot;:&quot;campaigns-efg&quot;},&quot;name&quot;:&quot;campaigns-efg&quot;,&quot;relationshipMap&quot;:{&quot;PARENT&quot;:[&quot;folder:campaigns-folder1&quot;]},&quot;schema&quot;:&quot;schema2&quot;,&quot;type&quot;:&quot;CAMPAIGN&quot;,&quot;uri&quot;:&quot;/schemas/schema2/campaigns/campaigns-efg&quot;,&quot;uriIndex&quot;:&quot;_schemas_schema2_campaigns_campaigns-efg&quot;,&quot;version&quot;:&quot;1.0&quot;}  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The highlighted entries show the Riak Link and secondary index on the current object. This is a valuable debugging tool to ensure the object has the correct relationship.&lt;br /&gt;
&lt;h4&gt;
Search&lt;/h4&gt;
&lt;div&gt;
Use search command line tool to execute free text search,
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; search-cmd search bucket-name query  
&lt;/code&gt;&lt;/pre&gt;
Query string is something like &quot;type:Folder&quot;, etc.
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
To use the HTTP API,
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; curl http://localhost.com:8098/solr/bucket-name/select?q=name:foo  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/6006255150025602454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/08/riak-http-api-cheat-sheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/6006255150025602454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/6006255150025602454'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/08/riak-http-api-cheat-sheet.html' title='Riak HTTP API Cheat Sheet'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-8711589252613840265</id><published>2012-07-12T14:05:00.004-07:00</published><updated>2012-08-22T10:25:39.995-07:00</updated><title type='text'>Riak Java Client Distilled</title><content type='html'>In this blog, we will show how to use Riak Java client to,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Create/update objects&lt;/li&gt;
&lt;li&gt;Enable and search by secondary index&lt;/li&gt;
&lt;li&gt;Add links and walk links&lt;/li&gt;
&lt;li&gt;Enable and search by free text through MapReduce&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;h2&gt;
Riak Configuration&lt;/h2&gt;
&lt;div&gt;
There are a few configuration changes that we will need to make to app.config to enable secondary index and listening for all ports,&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Change back end to use&lt;span style=&quot;color: #444444; font-family: sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 16px;&quot;&gt;&amp;nbsp;ELevelDB, the only storage engine that supports secondary index&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444; font-family: sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 16px;&quot;&gt;Change localhost or 127.0.0.1 to 0.0.0.0 for all IP addresses so Riak will listen on all ports&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444; font-family: sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 16px;&quot;&gt;Enable Riak for search by modifying app.config file &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;pre&gt;{riak_search, [
                %% To enable Search functionality set this &#39;true&#39;.
                {enabled, true}
               ]}
&lt;/pre&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h2&gt;





















Riak Java Client&lt;/h2&gt;
&lt;div&gt;
All Riak server access is done through a Riak client.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Which Riak Client to Use&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Riak Java library offers two types of Riak clients, which is very confusion. We found that most tasks can be accomplished using the pbc (low level protocol buffer client) client, except for the following exceptions that one must use the HPTT client,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Enable free text search for buckets&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;How to Obtain a Riak Client&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; RiakClient riakClient = RiakFactory.pbcClient(host, port);  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Shutdown Riak Client in the End&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
One must shutdown all active risk client before shutting down the application/Tomcat server itself.&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; riakClient.shutdown();  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;Create, Update, and Lookup Object&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Riak Client API offers a few annotations to indicate a particular field and we highly recommend use them rather than playing around the metadata ourselves,&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The Riak Key field (through @RiakKey annotation)&lt;/li&gt;
&lt;li&gt;A Riak secondary index field (through @RiakIndex annotation)&lt;/li&gt;
&lt;li&gt;A Riak links collection field (through @RiakLinks annotation)&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
When we persist an annotated object through Riak client, Riak client will process the key, secondary indices, and links first before handling the object to Jackson for serializing into JSON string and storing the JSON string in Riak. If we choose to manage the object serialization/deserialization through Jackson ourselves, we must also handle the metadata changes like a new secondary index is added/removed or new links are added or removed. If not handled carefully, we could easily lose the existing secondary indices/links when an object is updated.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is an example highlighting the usage of above annotations,&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; public class JsonObject  
 {  
   @JsonProperty  
   String bucket;  
   
   @RiakKey  
   String key;  
   
   @JsonProperty  
   String name;  
   
     
   @RiakLinks  
   @JsonIgnore  
   Collection&amp;lt;RiakLink&amp;gt; riakLinks = new ArrayList&amp;lt;RiakLink&amp;gt;();  
   
     
   @RiakIndex(name = &quot;uri&quot;)  
   @JsonProperty  
   String uriIndex;  
   
  }  &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
To save/update an object,&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; this.riakClient.createBucket(bucket).execute().store(object).execute();  
   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
To lookup an object by key,
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;   
 @Override  
   public &amp;lt;T&amp;gt; T get(final String bucket, final String key, final Class&amp;lt;T&amp;gt; kclass)  
   {  
     try  
     {  
       return this.riakClient.fetchBucket(bucket).execute().fetch(key, kclass).execute();  
     }  
     catch (final RiakRetryFailedException e)  
     {  
       throw new RuntimeException(e);  
     }  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Secondary Index Creation and Retrieval

&lt;/b&gt;&lt;br /&gt;
When an object&#39;s field has @RiakIndex annotated, secondary index is automatically created/updated when the object is stored or updated.&lt;br /&gt;
&lt;br /&gt;
To look up an object based on secondary index,&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; public List&amp;lt;String&amp;gt; fetchIndex(final String bucket, final String indexName, final String indexValue)  
   {  
     try  
     {  
   
       return this.riakClient.fetchBucket(bucket).execute().fetchIndex(BinIndex.named(indexName))  
           .withValue(indexValue).execute();  
     }  
     catch (final RiakException e)  
     {  
       throw new RuntimeException(e);  
     }  
   
     // Collection&amp;lt;String&amp;gt; collection = results.getResult(String.class);  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Riak Search
&lt;/b&gt;&lt;br /&gt;
Riak search must be enabled at the bucket level before Riak will index properties on all objects in the bucket. To&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; bin/search-cmd install my_bucket_name  
&lt;/code&gt;&lt;/pre&gt;
To execute a Riak search on a given bucket,
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; @Override  
   public Collection&amp;lt;JsonObject&amp;gt; search(final String bucket, final String criteria)  
   {  
     try  
     {  
       final MapReduceResult mapReduceResult = this.riakClient.  
           mapReduce(bucket, criteria)  
           .addMapPhase(new NamedJSFunction(&quot;Riak.mapValuesJson&quot;)).execute();  
       return mapReduceResult.getResult(JsonObject.class);  
     }  
     catch (final Exception e)  
     {  
       throw new RuntimeException(e);  
     }  
   }  
&lt;/code&gt;&lt;/pre&gt;
Where parameter bucket is the bucket name and the criteria is the search criteria like &quot;type=Folder&quot; or &quot;(type=Folder AND name=Hello)&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Riak Link Walking


&lt;/b&gt;&lt;br /&gt;
Riak link walking apparently only with HTTP client, not the pbc client for some reason.&lt;br /&gt;
&lt;br /&gt;
Here is a sample code to link walk a specific number of steps from the current object, identified by key.&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  @Override  
   public List&amp;lt;List&amp;lt;String&amp;gt;&amp;gt; walk(  
                   final String bucket, // bucket name  
                   final String key,  // originating object key  
                   final String linkName,  // link name  
                   final int steps   // number of steps to walk. Riak will stop if it can&#39;t walk further  
                   )  
   {  
     final List&amp;lt;List&amp;lt;String&amp;gt;&amp;gt; walkResults = new ArrayList&amp;lt;List&amp;lt;String&amp;gt;&amp;gt;();  
   
     try  
     {  
       final LinkWalk linkWalk = this.riakHttpClient.walk(this.riakHttpClient.createBucket(bucket).execute().fetch(key)  
           .execute());  
   
       for (int i = 0; i &amp;lt; steps; i++)  
       {  
         linkWalk.addStep(bucket, linkName, true);  
       }  
       final WalkResult walkResult = linkWalk.execute();  
   
       final Iterator&amp;lt;Collection&amp;lt;IRiakObject&amp;gt;&amp;gt; it = walkResult.iterator();  
       while (it.hasNext())  
       {  
         final List&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;String&amp;gt;();  
         final Collection&amp;lt;IRiakObject&amp;gt; collections = it.next();  
   
         for (final IRiakObject riakObject : collections)  
         {  
           list.add(riakObject.getKey());  
         }  
         if (list.size() &amp;gt; 0)  
         {  
           walkResults.add(list);  
         }  
       }  
     }  
     catch (final Exception e)  
     {  
       throw new RuntimeException(e);  
     }  
   
     return walkResults;  
   }  
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/8711589252613840265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/07/riak-java-client-distilled.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/8711589252613840265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/8711589252613840265'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/07/riak-java-client-distilled.html' title='Riak Java Client Distilled'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-545273262409371711</id><published>2012-07-10T07:28:00.001-07:00</published><updated>2012-07-11T13:56:26.842-07:00</updated><title type='text'>Why We Chose Riak</title><content type='html'>&lt;br /&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 8px; margin-left: 16px; margin-right: 16px; margin-top: 8px; min-width: 0px; width: 653px;&quot;&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
In this blog, we will discuss why we chose Riak as one of the persistence storage engines for our next generation platform. In the next blog, we will show how to use Riak Java client library to create and update objects, creating new secondary index, links, and free text search.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Object Model&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Just recap our dual object model, one for external interfacing RESTful Web Services and the internal persistence object model below.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv70yNSa8EUjYyTPD91EJb_dBTlO4Oqg8S2A2jaEg6oQc_i988eZ-lu78Q8HSaNsp-kGzJK_l5dXaQfg6ZucHZFwaT7Ysa0Zh4PiTPR-QhcRgRsnUjzPtVAIN3w8tdaMEtziheh3XAZvTC/s1600/object-model.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;342&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv70yNSa8EUjYyTPD91EJb_dBTlO4Oqg8S2A2jaEg6oQc_i988eZ-lu78Q8HSaNsp-kGzJK_l5dXaQfg6ZucHZFwaT7Ysa0Zh4PiTPR-QhcRgRsnUjzPtVAIN3w8tdaMEtziheh3XAZvTC/s640/object-model.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
We store only JSONWrapper objects in Riak, along with the appropriate relationships and links. We also need to search for objects based on their name, type, etc.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Why We Chose Riak&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
I have been playing around with Riak for the past month and came to the conclusion that Riak is a good &amp;nbsp;option for our next generation platform, for the following reasons;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;Ever-Evolving Object Model&lt;/b&gt;&lt;br /&gt;
The highly adaptive nature of our object model is not a good fit for the traditional ORM on top of RDBMS, as the object model is highly customizable from customer and customer and may evolve from version to version. The transitional ORM would require RDBMS schema to continuously keep up with our ever-evolving object model, requiring enormous efforts on Engineering, Testing, and Operations.&lt;br /&gt;
&lt;br /&gt;
The platform really does not care about the customized and highly evolved properties of object types. In other words, the platform only needs to know a pre-defined set of object properties for persistence and relationship resolution purpose and does not need to know all the other properties.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Riak, on the other hand, gives us the flexibility for storing opaque objects and we decide to store objects as JSON rather than Java objects or XML because JSON serialization is much more flexible and compact and needs far less storage than Java or XML.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;b&gt;High Availability and Multi-Data Center Support&lt;/b&gt;&lt;br /&gt;
Riak is built as a distributed data storage, with tunable read and write replica strategy.&lt;br /&gt;
Riak Enterprise offers multi-data center replication.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Free Text Search&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Riak comes with build-in free text search support, built on top of Lucene.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Adjacency Link Walking&lt;/b&gt;&lt;br /&gt;
Our object model relies on adjacent link between objects and it is critical to be able to follow the object graph through these adjacency links. Riak offers MapReduced based link walking functionality so we can easily retrieve all objects that are linked to a particular object through any levels of links.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Secondary Index Support&lt;/b&gt;&lt;br /&gt;
Like RDBMS, Riak offers secondary index support in addition to primary key lookup.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Multi-Tenant Support&lt;/b&gt;&lt;br /&gt;
Our platform must support multi-tenancy for security, partition and performance reasons, which is not trivial to accomplish in a RDBMS environment.&lt;br /&gt;
&lt;br /&gt;
Riak, on the other hand, partitions data naturally in buckets and buckets are distributed across different nodes. Tenants can be mapped to buckets and data level security can be accomplished through securing access to buckets. If we store &amp;nbsp;a tenant related data in the same bucket, a user can only access the data if he has access to the bucket and he can&#39;t access any objects not belong to accessible buckets.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ad Hoc Query Support Through MapReduce&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Riak provides us the ability to run Ad Hoc queries through the entire data set, through a series Map and Reduce phases. The only limitation is that MapReduce is executed in memory and must complete with a timeout limit. This is not a major concern given the size of data set.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Performance&lt;/b&gt;&lt;br /&gt;
Riak is based on a distributed data model, which should perform better than master-slave type of model.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Operation and Monitoring Support&lt;/b&gt;&lt;br /&gt;
Riak ships with a UI monitoring tool and a set of commends for other administrative tasks like backup/restore, etc.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Concerns about Riak&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
We do have concerns regarding Riak from a business perspective. Even though Riak is an open source solution, its commercial backer Basho is still relatively young and the user community is not as big as Hadoop, Cassandra, or MongoDB.&lt;br /&gt;
&lt;br /&gt;
To mitigate the risk, we built a persistence abstraction layer that allows us to swamp Riak with a different NoSQL technology in the future if necessary.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/545273262409371711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/07/why-we-chose-riak-as-persistence.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/545273262409371711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/545273262409371711'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/07/why-we-chose-riak-as-persistence.html' title='Why We Chose Riak'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv70yNSa8EUjYyTPD91EJb_dBTlO4Oqg8S2A2jaEg6oQc_i988eZ-lu78Q8HSaNsp-kGzJK_l5dXaQfg6ZucHZFwaT7Ysa0Zh4PiTPR-QhcRgRsnUjzPtVAIN3w8tdaMEtziheh3XAZvTC/s72-c/object-model.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-2040424980296835844</id><published>2012-07-09T20:21:00.003-07:00</published><updated>2012-07-09T20:41:33.267-07:00</updated><title type='text'>Building an Adaptive Object Model</title><content type='html'>In this series of blogs, we will discuss how we build our next generation platform using Jeresy, Jackson, JSON, and Riak. But first, we will show how to build an adaptive object model, supporting multiple versions of object types simultaneously.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;


Object Model Requirement&lt;/h3&gt;
&lt;div&gt;
For our platform, we are storing various types of configuration objects, with parent/child relationship linking objects together. Each object type has a set of fixed pre-defined properties and a set of custom properties, which can vary from customer to customers.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;


Support Versioned Objects&lt;/h3&gt;
&lt;div&gt;
As our platform evolves, our object model will need to adapt and evolve, which means we need to support and store different versions of same object type. Properties can be added or removed between different versions.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Building an Adaptive Object Model&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
After some exploring, we decided to go with two set of object models, an explicit object model for Web Services and a generic persistence object model.&lt;br /&gt;
&lt;br /&gt;
Here is a picture of the two object models,&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv70yNSa8EUjYyTPD91EJb_dBTlO4Oqg8S2A2jaEg6oQc_i988eZ-lu78Q8HSaNsp-kGzJK_l5dXaQfg6ZucHZFwaT7Ysa0Zh4PiTPR-QhcRgRsnUjzPtVAIN3w8tdaMEtziheh3XAZvTC/s1600/object-model.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;342&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv70yNSa8EUjYyTPD91EJb_dBTlO4Oqg8S2A2jaEg6oQc_i988eZ-lu78Q8HSaNsp-kGzJK_l5dXaQfg6ZucHZFwaT7Ysa0Zh4PiTPR-QhcRgRsnUjzPtVAIN3w8tdaMEtziheh3XAZvTC/s640/object-model.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The generic object graph approach consists of two layers of abstraction, a wrapper object and an inner JSON object. The wrapper layer contains the following static information that does not change from one version to another, like,&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Object name&lt;/li&gt;
&lt;li&gt;Object key&lt;/li&gt;
&lt;li&gt;Object type&lt;/li&gt;
&lt;li&gt;Object uri&lt;/li&gt;
&lt;li&gt;Object version&lt;/li&gt;
&lt;li&gt;A relationship map&lt;/li&gt;
&lt;li&gt;Parent id&lt;/li&gt;
&lt;/ul&gt;
and a map representation of the inner JSON object.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div&gt;
The inner JSON object is the JSON object created by the user or will be returned to the user. The inner JSON object can be different from version to version and from type to type. Since the platform does not need to know what is actually stored in the inner JSON object, other than a set of standard fields, like,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Object name&lt;/li&gt;
&lt;li&gt;Object type&lt;/li&gt;
&lt;li&gt;Object version&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
The platform just stores the wrapper object, with inner object as an opaque map. Since the wrapper object structure does not change based on version or type and the inner object is stored as a generic Map type, the platform does not need to change every time we add a new object type or change an existing object type.&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;

Object Validation&lt;/h2&gt;
&lt;/div&gt;
However, we still need to validate user supplied JSON object to make sure that it matches the correct version of the object type. We accomplish this by creating a set of validating classes and register them by type and version. When we receiving an object creation request, we will first deserialize the input JSON to a raw Map type and pull out the type and version from the map object. Then we look up the validation class based on type and version and then deserialize the input JSON object again based on the validation class.&lt;br /&gt;
&lt;br /&gt;
When a new type is introduced or new version of type is introduced, we just update the validation map with the new configuration and deploy the new classes and nothing else needs to be changed.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;

Sequence Diagram for Web Services&lt;/h2&gt;
Create a New Object through Web Services.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7KufkD50CBBJciBjsFadvIrcwT5PLrxODltB3lxeER2oF3aO7QIMd9YTPAPRiwQMGQrKDLTeVWDGRhkCIpZzwuD8wFRrOXtFm0uhgaCCZBWKLMhum6rnJQdN5Bib7pOLykAj_UisOga4O/s1600/diagram.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;466&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7KufkD50CBBJciBjsFadvIrcwT5PLrxODltB3lxeER2oF3aO7QIMd9YTPAPRiwQMGQrKDLTeVWDGRhkCIpZzwuD8wFRrOXtFm0uhgaCCZBWKLMhum6rnJQdN5Bib7pOLykAj_UisOga4O/s640/diagram.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Get an Object through Web Services.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCOQBT1Z_VGTPSJMWPlY5rqK-MGYa9q2wK8tCUFGSgGi4qUKYLpJYF6EDZ-xPVWsRXR_RvZHuRXzWokLKYNn2X3_Upn38PZaO3SKkFYS9A2tfhUoHbBzBYDA8TgHdyL8j3hJaXZhaygBcP/s1600/diagram-1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;303&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCOQBT1Z_VGTPSJMWPlY5rqK-MGYa9q2wK8tCUFGSgGi4qUKYLpJYF6EDZ-xPVWsRXR_RvZHuRXzWokLKYNn2X3_Upn38PZaO3SKkFYS9A2tfhUoHbBzBYDA8TgHdyL8j3hJaXZhaygBcP/s640/diagram-1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;

&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/2040424980296835844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/07/building-adaptive-object-model.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/2040424980296835844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/2040424980296835844'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/07/building-adaptive-object-model.html' title='Building an Adaptive Object Model'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv70yNSa8EUjYyTPD91EJb_dBTlO4Oqg8S2A2jaEg6oQc_i988eZ-lu78Q8HSaNsp-kGzJK_l5dXaQfg6ZucHZFwaT7Ysa0Zh4PiTPR-QhcRgRsnUjzPtVAIN3w8tdaMEtziheh3XAZvTC/s72-c/object-model.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-906622027071118665</id><published>2012-06-19T12:43:00.002-07:00</published><updated>2012-06-22T13:45:55.773-07:00</updated><title type='text'>First Impression on Riak vs mongoDB vs Cassandra/HBase</title><content type='html'>As part of the building out the next generation technology platform, we would like to explore NoSQL solutions to compliment our existing platform, which is built on RDBMS, primarily Oracle.&lt;br /&gt;
&lt;br /&gt;
I have used mongoDB, Cassandra and HBase in the past life and I am eager to learn what Riak could offer as an alternative NoSQL solution.&lt;br /&gt;
&lt;br /&gt;
In the next few weeks, I will be publishing our findings, lessons learned along the way. In this post, I will give my first un-biased impression on Riak vs other NoSQL technologies.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;



First Impression on Riak&lt;/h3&gt;
&lt;div&gt;
Riak is an open source, distributed database solution, written in Erlang and supported by Basho. From first glimpse, it offers the following nice features,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Objects are stored by buckets and keys&lt;/li&gt;
&lt;li&gt;Really nice HTTP API (for developing/debugging purpose)&lt;/li&gt;
&lt;li&gt;Horizontal and linear scalability&lt;/li&gt;
&lt;li&gt;Masterless replication with tunable read/write consistency level&lt;/li&gt;
&lt;li&gt;Consist Key Hashing and even load distribution&lt;/li&gt;
&lt;li&gt;Automatically rebalancing when new nodes are introduced or removed&lt;/li&gt;
&lt;li&gt;Support Linkage between objects, a nature way to build hierarchy object model&lt;/li&gt;
&lt;li&gt;Complex query support including secondary index, free text search, and MapReduce support&lt;/li&gt;
&lt;li&gt;Excellent client library support&lt;/li&gt;
&lt;li&gt;Thousands of name branded customers&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
From the first glance, Riak is very much like Cassandra with automatic cluster management, nicer API, and much less complexity in terms of cluster management and learning curve (no more Thrift API).&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
On the other other hand, Riak is a strict name/value pair model and does not offer column family or super column family support, as supported in Cassandra/HBase. I guess we can simulate column family support by turning bucket into row key, and keys into column family columns.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Overall, Riak looks like a good candidate for our prototyping and I will share our experience in the next &amp;nbsp;few blogs.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/906622027071118665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/first-impression-on-riak-vs-mongodb-vs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/906622027071118665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/906622027071118665'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/first-impression-on-riak-vs-mongodb-vs.html' title='First Impression on Riak vs mongoDB vs Cassandra/HBase'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-8498663126580414367</id><published>2012-06-19T06:22:00.000-07:00</published><updated>2012-06-19T06:22:02.945-07:00</updated><title type='text'>Performance Tuning Hibernate Transaction Flush Mode</title><content type='html'>I have been using Hibernate on and off for the post ten years and here are some tips and tools that I have used to help me identify, tune, and improve Hibernate performance.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;



Tip 1 Use a good JDBC Profiler&lt;/h4&gt;
&lt;div&gt;
My personal favorite is &lt;a href=&quot;http://www.elvyx.com/&quot;&gt;Elvyx&lt;/a&gt;, which is easy to install, configure, and use. While Hibernate SQL log is useful, it is not easy to read and it won&#39;t show the actual parameters sent to the database. Elvyx, on the other hand, has a UI that will show both unbound (similar to Hibernate) and bound SQL, which shows the actual parameters in the SQL. Elvyx UI also allows us to do the following,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Sort the queries&lt;/li&gt;
&lt;li&gt;Total time eclipsed summary graph&lt;/li&gt;
&lt;li&gt;Drill down to a single query and how execution status&lt;/li&gt;
&lt;li&gt;Export data into Excel and other formats&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3&gt;



&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small; font-weight: normal;&quot;&gt;A JDBC profiler should be used as part of the development, QA process to catch potential performance issues and in production to help trouble shoot live performance issues.&lt;/span&gt;&lt;/h3&gt;
&lt;h3&gt;



In Development and QA&lt;/h3&gt;
&lt;div&gt;
In development, JDBC profiler should be used to profile every Web Services call or every single page-turn for web applications, to identify the following potential performance issues,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Hibernate is generating the correct SQL (from HQL)&lt;/li&gt;
&lt;li&gt;Hibernate is loading just right amount of data (use lazy loading whenever possible)&lt;/li&gt;
&lt;li&gt;Hibernate is generating the correct amount of SQL calls. An abnormal amount of SQL calls per web service call or per web page turn indicates poor design and potential performance issue&lt;/li&gt;
&lt;li&gt;Look for SQL that is taking long time to execute. Examine the explain plan and make sure the plan makes sense. If the generated sql does not meet requirement, consider rewriting the query or using native SQL or a function or a stored procedure for better performance&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;



In Production&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
Since Elvyx is not intrusive and does not recompiling application or any other type of special treatment, it is ideal to trouble shoot live production performance issue. Simple deploy, configure, restart, and start troubleshooting.&lt;/div&gt;
&lt;h4&gt;



Tip 2 Understand Transaction Flush Mode&lt;/h4&gt;
&lt;div&gt;
Most people don&#39;t understand Hibernate Transaction Flush Mode and what is the most appropriate Flush mode to use. Wrong Transaction Flush mode will lead to huge performance issues.&lt;br /&gt;
&lt;h3&gt;


What is Transaction Flush Mode&lt;/h3&gt;
Hibernate does not flush every add or update transaction to the database. Rather Hibernate collects them and waits for the right time to flush them all t the database. And the right time is defined by the Transaction Flush mode. There are four Flush mode,&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Always, the session is flushed every query&lt;/li&gt;
&lt;li&gt;Commit, the session is flushed when transaction is committed&lt;/li&gt;
&lt;li&gt;Manuel, the session is flushed manually, i.e., Hibernate will NOT flush session to the database during query or commit time&lt;/li&gt;
&lt;li&gt;Auto, default Flush mode and yet the most confusion one. The session is flushed before a query is executed or transaction is committed&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;

Why we need transaction Flush mode?&lt;/h3&gt;
&lt;div&gt;
Database transaction is expensive and does not perform well so Hibernate turns auto commit off. Hibernate defers database transaction until the end when all necessary database updates have been made.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For example, in a transaction, we can do the following,&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Begin transaction&lt;/li&gt;
&lt;li&gt;Create employee A&lt;/li&gt;
&lt;li&gt;Create employee B&lt;/li&gt;
&lt;li&gt;Associate A with its manager C&lt;/li&gt;
&lt;li&gt;Associate B with its manager D&lt;/li&gt;
&lt;li&gt;Commit transaction&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Instead of 4 separate transactions, we only need a single transaction. Very efficient.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now, if we change the follow a little,&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Begin transaction&lt;/li&gt;
&lt;li&gt;Create employee A&lt;/li&gt;
&lt;li&gt;Create employee B&lt;/li&gt;
&lt;li&gt;Associate A with its manager C&lt;/li&gt;
&lt;li&gt;Look up all employees reporting to C&lt;/li&gt;
&lt;li&gt;Associate B with its manager D&lt;/li&gt;
&lt;li&gt;Look up all employees reporting to D&lt;/li&gt;
&lt;li&gt;Commit transaction&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
If we don&#39;t&#39; call transaction flush before step 5 and step 7, we will get incorrect results, because the query results won&#39;t include the newly created employee A and B. If we want to include newly created results in the query results before committing them to the database, we must flush the pending transactions (creation of employee A and B) to the database before they can be included in a later query.&lt;br /&gt;
&lt;br /&gt;
Hibernate default Flush mode, AUTO, is designed to be overly cautious and does a database flush every time before executing a query. It is designed to protect novice user but it does come with a hefty performance penalty.&lt;br /&gt;
&lt;h3&gt;
What is the Performance Penalty associated with Database Transaction Flushing&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Hibernate does not keep track of which object has been modified in session object. In order to do a proper transaction flush, it must first determine which object has changed in the session by going through ALL the objects in the session and comparing the current object with what&#39;s in the database one object at a one. This process is extremely CPU intensive and only gets worse if one has a lot of objects loaded in the session, which is typical in a bulk load/update type of transactions.&lt;/div&gt;
&lt;h3&gt;


Default Flush Mode introduces Performance Problem during Bulk Operations&lt;/h3&gt;
&lt;div&gt;
We had a page that creates a new campaign based on an existing campaign template via a deep copying . A campaign object could contain possibly hundreds of other objects. A typical flow is like the following,&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Begin Transaction&lt;/li&gt;
&lt;li&gt;Retrieve the template campaign&lt;/li&gt;
&lt;li&gt;Shallow copy and save the top level campaign objects&lt;/li&gt;
&lt;li&gt;For each top level campaign object&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Retrieve next level campaign objects&lt;/li&gt;
&lt;li&gt;Shallow copy and save the secondary level campaign objects&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Iterate through all nested objects&lt;/li&gt;
&lt;li&gt;Commit Transaction&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
A typical copy operation takes 30 minutes. This clearly indicates a performance issue. After further investigation, we traced the problem back to hefty performance cost introduced by database transaction flush.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For each select statement like retrieving the next level campaign objects, Hibernate does a database flush and as the number of objects loaded in the session increases, the time to determine the &quot;dirty&quot; objects increases dramatically. And there is absolute NO need to do database flush, since we are NOT making any changes to existing objects, only creating new ones.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The solution is to switch the default flush mode to COMMIT. This cuts the execution time from 30 minutes to 3 seconds.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So next time if an operation takes abnormal long time to execute and it is not being held up by the database itself, check Hibernate transaction flush mode carefully. Typically I use either MANUEL or COMMIT for any type of bulk operations or read-only operations.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;



Tip 3 Use Batch Operations&lt;/h4&gt;
&lt;div&gt;
As we have shown before, Hibernate carries huge performance penalty if we execute one query at a time, because of the overhead related to database transaction management. However, we can reduce this cost dramatically if we can batch a set of operations together and carry them out in a single transaction or a single query.&lt;/div&gt;
&lt;div&gt;
We had a page displaying a grid, which can be sorted or filtered by a set of criteria. The original implementation performs poorly because it is implemented like the following,&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Select a set of user ids based on the selection criteria&lt;/li&gt;
&lt;li&gt;Get each user for each returned user id&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
A must better performant implementation is like,&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Select a set of user ids based on selection criteria&lt;/li&gt;
&lt;li&gt;For every 300 user id&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Select users where user id in (the set of 300 users)&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
The second implementation is typically 10 to 20 times faster than the first one.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/8498663126580414367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/performance-tuning-hibernate.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/8498663126580414367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/8498663126580414367'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/performance-tuning-hibernate.html' title='Performance Tuning Hibernate Transaction Flush Mode'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-8531506598489065500</id><published>2012-06-15T10:49:00.001-07:00</published><updated>2012-06-15T10:49:25.982-07:00</updated><title type='text'>How to Update Facebook Status on user&#39;s behalf</title><content type='html'>In the previous blog entry,&amp;nbsp;&lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/06/how-to-tweet-through-app.html&quot;&gt;&quot;how to tweet on user&#39;s behalf&quot;&lt;/a&gt;, we talked about how to tweet on user&#39;s behalf through Twitter application. In this blog, we will discuss similar function on Facebook, i.e., how to update status on user&#39;s behalf. And necessary steps are very similar,&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create a Facebook campaign specific application&lt;/li&gt;
&lt;li&gt;Obtain an access token for a particular Facebook account. This process does require user to log into his/her Facebook account and explicitly grant permission to the Facebook app, which will post on user&#39;s behalf. Once the access token is retrieved, we can post on the user&#39;s behalf through the app. Unlike Twitter, the access token currently does expire in 60 days, upon which we must go through the same process of obtaining a new access token. Not very user friendly in our opinion.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;


Setting up a Facebook Application&lt;/h3&gt;
&lt;div&gt;
Step1. Go to&amp;nbsp;https://developers.facebook.com/&lt;/div&gt;
&lt;div&gt;
Step2. Fill in necessary information,&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsvgTp3FH5joVWZTGigY0rHDKydv-OV-4oQAjgJ2X40bOehIJoMrIo2M9C5C-f36uu1rYvph4wdyZ-oSCFNixRS33iOzmaKthRIDYc4tXoGQshy8G-vea64pEFOzfqfSIMb6-YxVXP-MPm/s1600/facebook-app.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;587&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsvgTp3FH5joVWZTGigY0rHDKydv-OV-4oQAjgJ2X40bOehIJoMrIo2M9C5C-f36uu1rYvph4wdyZ-oSCFNixRS33iOzmaKthRIDYc4tXoGQshy8G-vea64pEFOzfqfSIMb6-YxVXP-MPm/s640/facebook-app.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
App ID/App Key and App Secret will be used in obtaining access token.&lt;/div&gt;
&lt;h3&gt;


Obtaining Access Token&lt;/h3&gt;
&lt;div&gt;
Obtain an access token for a particular Facebook account. This process does require user to log into his/her Facebook account and explicitly grant permission to the Facebook app, which will post on user&#39;s behalf. Once the access token is retrieved, we can post on the user&#39;s behalf through the app. Unlike Twitter, the access token currently does expire in 60 days, upon which we must go through the same process of obtaining a new access token. Not very user friendly in our opinion.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the high level flow for obtaining a Facebook access token,&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMOdF0uZTNkRNre4nnvbVTxkfM2nTco4zkxKzCcOOHJGnO9eK8WbD98bq0eyr9m96ZZ9GL7HcgAFlDoAalw_NW8C237IcANoVtLQui6EnEyKG3uvbI-qIGBVgwJQXQ06wFhIm_rSPkveM4/s1600/facebook-high-level.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMOdF0uZTNkRNre4nnvbVTxkfM2nTco4zkxKzCcOOHJGnO9eK8WbD98bq0eyr9m96ZZ9GL7HcgAFlDoAalw_NW8C237IcANoVtLQui6EnEyKG3uvbI-qIGBVgwJQXQ06wFhIm_rSPkveM4/s640/facebook-high-level.jpg&quot; width=&quot;590&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the detailed sequence diagrams on obtaining access token,&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5PgCGra0THQxspRCZBNHVrvwQ1AuCJ-XC0mdHcLdSmOY5WONflV5gQuyKunBDvnbSqVXeGurmzyb3DlRNEpBzadtEN6FnyKBj2unMSA4gCXGbY8vq90fltI9qutExMNK5Z4RFAb4XAk_v/s1600/diagram-4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5PgCGra0THQxspRCZBNHVrvwQ1AuCJ-XC0mdHcLdSmOY5WONflV5gQuyKunBDvnbSqVXeGurmzyb3DlRNEpBzadtEN6FnyKBj2unMSA4gCXGbY8vq90fltI9qutExMNK5Z4RFAb4XAk_v/s1600/diagram-4.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Once an access token is granted, we can start updating user&#39;s status as the following,&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
HTTP POST &quot;https://graph.facebook.com/&quot; + facebookUser + &quot;/feed?access_token=&quot; + token + &quot;&amp;amp;message=&quot; + URLEncoder.encode(message, &quot;utf-8&quot;);
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/8531506598489065500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/how-to-update-facebook-status-on-users.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/8531506598489065500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/8531506598489065500'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/how-to-update-facebook-status-on-users.html' title='How to Update Facebook Status on user&#39;s behalf'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsvgTp3FH5joVWZTGigY0rHDKydv-OV-4oQAjgJ2X40bOehIJoMrIo2M9C5C-f36uu1rYvph4wdyZ-oSCFNixRS33iOzmaKthRIDYc4tXoGQshy8G-vea64pEFOzfqfSIMb6-YxVXP-MPm/s72-c/facebook-app.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-3692507675043265889</id><published>2012-06-15T08:16:00.000-07:00</published><updated>2012-06-15T10:44:29.326-07:00</updated><title type='text'>How to Tweet on user&#39;s behalf</title><content type='html'>As part of multichannel campaign, we would like to tweet on customer&#39;s behalf. In order to accomplish that, we need the following,&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Create a Twitter application, which will tweet on customer&#39;s behalf. The application should also contain the appropriate campaign information and URL&lt;/li&gt;
&lt;li&gt;Obtain an access token for a particular Twitter handle or handles. This process does require user to log into his/her Twitter accounts and explicitly grant permission to the Twitter app, which will tweet on user&#39;s behalf. Once the access token is retrieved, we can tweet on the user&#39;s behalf through the app. The access token currently does not expire, except for in the situation where user changes his password or revokes the access permission explicitly&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
In the blog, we walk through the necessary steps on how to obtain an access token.&lt;/div&gt;
&lt;h3&gt;













Setting up a Twitter Application&lt;/h3&gt;
&lt;div&gt;
Step1: Log into&amp;nbsp;https://dev.twitter.com/apps/new&lt;br /&gt;
Step2: Filling the necessary information for the App, including the appropriate information for the Campaign,&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzqFTRM52FY4wLYWAUVTeFfrzjcoxTVMbbtxDtj2RTtff_pp4ZPok4Je8nuHta5bNaC-BBHKCRt5BsZhwOSNaqJh8SNXsuf75-5lzYdLuG-tTubRRCy-qdqUaY7UoLH-alPbbgTlb-DpgH/s1600/twitter.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;608&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzqFTRM52FY4wLYWAUVTeFfrzjcoxTVMbbtxDtj2RTtff_pp4ZPok4Je8nuHta5bNaC-BBHKCRt5BsZhwOSNaqJh8SNXsuf75-5lzYdLuG-tTubRRCy-qdqUaY7UoLH-alPbbgTlb-DpgH/s640/twitter.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Consumer Key, Consumer secret, and Callback URL will be used in obtaining access token.
&lt;/div&gt;
&lt;h3&gt;







Obtaining Twitter Access Token&lt;/h3&gt;
&lt;div&gt;
Obtaining Twitter access token does require user to log into his/her Twitter accounts and explicitly grant permission to the Twitter app, which will tweet on user&#39;s behalf. Once the access token is retrieved, we can tweet on the user&#39;s behalf through the app. The access token currently does not expire, except for in the situation where user changes his password or revokes the access permission explicitly.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is a high level interaction diagram on this process,&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8L9zXq8ardfuUEowh2AOZUruJ7QTOuNYcXFVoFyYrbUMEGkZhe9GSLHY0lP5A4kn2kRW7oyT23ajGJYswLQ-80_05eZiGLPzDRmbAIhdxFR216x-2Di9erPcUEnFxBqZsvnZBP-TgYwW4/s1600/twitter-high-level.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8L9zXq8ardfuUEowh2AOZUruJ7QTOuNYcXFVoFyYrbUMEGkZhe9GSLHY0lP5A4kn2kRW7oyT23ajGJYswLQ-80_05eZiGLPzDRmbAIhdxFR216x-2Di9erPcUEnFxBqZsvnZBP-TgYwW4/s640/twitter-high-level.jpg&quot; width=&quot;588&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;br /&gt;
Here is the corresponding sequence diagram,&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcm6Z7bAnvxfLol9QhkMhi-13ArzyefSCIhAfcTccc-fY2S0HQkMsZEReuCzBiNs8VnFWVlXav0Um292ZsUEGCDP9oJTes-ozF1Y0bEDcqI88whTyyxLRD37pkbq9EuELKSrxAYKPAkQXT/s1600/diagram-3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcm6Z7bAnvxfLol9QhkMhi-13ArzyefSCIhAfcTccc-fY2S0HQkMsZEReuCzBiNs8VnFWVlXav0Um292ZsUEGCDP9oJTes-ozF1Y0bEDcqI88whTyyxLRD37pkbq9EuELKSrxAYKPAkQXT/s1600/diagram-3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
Once an access token and associated token secret are obtained, we can store them in a persistent storage&lt;br /&gt;
and tweet on behalf of the user.&lt;br /&gt;
Twitter native Web Services API is very hard to use and we highly recommend going with Twitter4j.</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/3692507675043265889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/how-to-tweet-through-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/3692507675043265889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/3692507675043265889'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/how-to-tweet-through-app.html' title='How to Tweet on user&#39;s behalf'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzqFTRM52FY4wLYWAUVTeFfrzjcoxTVMbbtxDtj2RTtff_pp4ZPok4Je8nuHta5bNaC-BBHKCRt5BsZhwOSNaqJh8SNXsuf75-5lzYdLuG-tTubRRCy-qdqUaY7UoLH-alPbbgTlb-DpgH/s72-c/twitter.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-4856752637620283422</id><published>2012-06-06T11:18:00.001-07:00</published><updated>2012-06-06T11:23:38.221-07:00</updated><title type='text'>How to use Apache HttpClient 4 library securely connect to RESTful Web Service</title><content type='html'>In this blog, we will show to how to securely connect to RESTful web services, using Apache HttpClient 4 and HTTPS and basic authentication through username and password&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;








Self-signed Certificate Support&lt;/h3&gt;
Apache HttpClient 4 has changed quite a bit from version 3 and has much better self-signed certificate support. In order to support self-signed certificates, we need to create a new class that implements TrustStrategy called TrustSelfSignedStrategy and our TrustSelfSignedStrategy will trust any certificates and just return true. This class is just for illustration purpose and shouldn&#39;t be used in production.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;   protected static class TrustSelfSignedStrategy implements TrustStrategy  
   {  
     @Override  
     public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException  
     {  
       return true;  
     }  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The following code shows how to create a ClientConnectionManager object using the above TrustSelfSignedStrategy.&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;   protected ClientConnectionManager enableSelfSignedCerts() throws Exception  
   {  
     TrustStrategy trustStrategy = new TrustSelfSignedStrategy();  
     X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();  
     SSLSocketFactory sslSf = new SSLSocketFactory(trustStrategy, hostnameVerifier);  
     Scheme https = new Scheme(&quot;https&quot;, 443, sslSf);  
     SchemeRegistry schemeRegistry = new SchemeRegistry();  
     schemeRegistry.register(https);  
     ClientConnectionManager connection = new PoolingClientConnectionManager(schemeRegistry);  
     return connection;  
   }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;






Preemptive Basic Authentication with Username and Password&lt;/h3&gt;
&lt;div&gt;
Next we will show how to use preemptive basic authentication using username and password. In web services world we must use preemptive basic authentication, since there is no web client to ask back to and prompt user for authentication credentials.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;       String urlString = PING_IDENTITY_SERVER_URL + TOKEN_AUTH + URLEncoder.encode(TEST_TOKEN, &quot;UTF-8&quot;);  
       URL url = new URL(urlString);  
       // support self-signed certificates  
       DefaultHttpClient httpClient = new DefaultHttpClient(enableSelfSignedCerts());  
       // add username/password for BASIC authentication  
       httpClient.getCredentialsProvider().setCredentials(new AuthScope(url.getHost(), url.getPort()),  
           new UsernamePasswordCredentials(&quot;user&quot;, &quot;secret&quot;));  
       // Create AuthCache instance  
       // Add AuthCache to the execution context  
       AuthCache authCache = new BasicAuthCache();  
       BasicScheme basicAuth = new BasicScheme();  
       authCache.put(new HttpHost(url.getHost(), url.getPort(), url.getProtocol()), basicAuth);  
       BasicHttpContext localcontext = new BasicHttpContext();  
       localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);  
       //  
       HttpGet getRequest = new HttpGet(urlString);  
       getRequest.setHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);  
       // call HTTP GET with authentication information  
       HttpResponse response = httpClient.execute(getRequest, localcontext);  
       if (response.getStatusLine().getStatusCode() != 200)  
       {  
         throw new RuntimeException(&quot;Failed : HTTP error code : &quot; + response.getStatusLine().getStatusCode());  
       }  
       BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent()))); 
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;

Troubleshooting Tips&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
If getting a 401 error, make sure that preemptive authentication is used and username and password is correct.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/4856752637620283422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/how-to-use-apache-httpclient-4-library.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/4856752637620283422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/4856752637620283422'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/how-to-use-apache-httpclient-4-library.html' title='How to use Apache HttpClient 4 library securely connect to RESTful Web Service'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-6631896562666026208</id><published>2012-06-02T20:46:00.000-07:00</published><updated>2012-06-08T06:13:02.331-07:00</updated><title type='text'>Secure Jersey with OAuth2, Open Authentication Framework</title><content type='html'>&lt;h2&gt;






&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;Overview&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;Our platform must be secure. After some initial investigation, we decided to go with OAuth2, the next generation of OAuth protocol. The OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers. More generally, OAuth creates a freely-implementable and generic methodology for API authentication.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;






&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Securing Jersey with OAuth2&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;We looked at implementing OAuth2 support as Tomcat security realm, servlet filter, or Tomcat valve. In the end, we decided to go with Tomcat valve for the following reasons,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;Since we are implementing web services and not web applications, there is no standard way of caching Tomcat session between requests. This makes session based security realm irrelevant.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;Servlet filer can do almost exactly the same thing as a Tomcat Valve, except for a servlet filter is deployed at web application level. This means we have to deploy this servlet for every web application we deploy. Not as convenient as a Tomcat valve&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;On the other hand, Tomcat valve is Tomcat specific. If we want a portable solution, we will have to stick with Servlet filter. Luckily we are sticking with Tomcat for now and there is very little effort if we need to switch to a Servlet filter based implementation&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;






&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;OAuth Tomcat Valve Class&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;Here is the example Valve class,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package jersey.oauth;  
 import java.io.IOException;  
 import javax.servlet.ServletException;  
 import javax.servlet.http.HttpServletResponse;  
 import org.apache.catalina.connector.Request;  
 import org.apache.catalina.connector.Response;  
 import org.apache.catalina.valves.ValveBase;  
 import com.sun.security.auth.UserPrincipal;  
 public class OAuthValve extends ValveBase  
 {  
     protected String identityServerURL;  
     public String getIdentityServerURL() {  
         return identityServerURL;  
     }  
     public void setIdentityServerURL(String identityServerURL) {  
         this.identityServerURL = identityServerURL;  
     }  
     @Override  
     public void invoke(Request request, Response response) throws IOException,  
             ServletException {  
         if (request.getMethod().equals(&quot;OPTIONS&quot;))  
             getNext().invoke(request, response);  
         else  
         {  
 //            response.sendError(HttpServletResponse.SC_FORBIDDEN);  
             String authentication = request.getHeader(&quot;authentication&quot;);  
             if (authentication == null)  
             {  
                 authentication = request.getParameter(&quot;access_token&quot;);  
             }  
             else  
             {  
                     String[] tokens = authentication.split(&quot; &quot;);  
                 if (tokens.length &amp;gt;= 2 &amp;amp;&amp;amp; tokens[0].equalsIgnoreCase(&quot;Bearer&quot;))  
                 {  
                     authentication = tokens[1];  
                 }  
                 else  
                 {  
                     authentication = null;  
                 }  
             }  
             if (authentication == null)  
                 response.sendError(HttpServletResponse.SC_UNAUTHORIZED);  
             else  
             {  
                 // TODO call identity server, passing on the access token
                 // Set return principal 
                 request.setUserPrincipal(new UserPrincipal(&quot;name&quot;));  
                 getNext().invoke(request, response);  
             }  
         }  
     }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;Here is the sample Host block of Tomcat server.xml file,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilqTcvopftOEyDE4Y19yGU4djSh39lxvn5Jj4s35yA0o4De4OIkkbFDVCqpMlhF8lC0KTTb_16C8oNJ_G0aGzr8X0JehzYc1_lw8wH-4Ej9XsZM4OtCDUbsCGXJyDxj0hL-nVaLhpSrrES/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;Host appBase=&quot;webapps&quot; autoDeploy=&quot;true&quot; name=&quot;localhost&quot; unpackWARs=&quot;true&quot; xmlNamespaceAware=&quot;false&quot; xmlValidation=&quot;false&quot;&amp;gt;  
     &amp;lt;!-- SingleSignOn valve, share authentication between web applications  
        Documentation at: /docs/config/valve.html --&amp;gt;  
     &amp;lt;!--  
     &amp;lt;Valve className=&quot;org.apache.catalina.authenticator.SingleSignOn&quot; /&amp;gt;  
     --&amp;gt;  
     &amp;lt;!-- Access log processes all example.  
        Documentation at: /docs/config/valve.html --&amp;gt;  
     &amp;lt;Valve className=&quot;org.apache.catalina.valves.AccessLogValve&quot; directory=&quot;logs&quot; pattern=&quot;common&quot; prefix=&quot;localhost_access_log.&quot; resolveHosts=&quot;false&quot; suffix=&quot;.txt&quot;/&amp;gt;  
         &amp;lt;Valve className=&quot;jersey.oauth.OAuthValve&quot; identityServerURL=&quot;localhost&quot;/&amp;gt;  
    &amp;lt;Context docBase=&quot;JerseyCors&quot; path=&quot;/jersey&quot; reloadable=&quot;true&quot; source=&quot;org.eclipse.jst.jee.server:JerseyCors&quot;/&amp;gt;&amp;lt;/Host&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 18px;&quot;&gt;Deploy, start Tomcat and test.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/6631896562666026208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/secure-jersey-with-oauth2.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/6631896562666026208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/6631896562666026208'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/secure-jersey-with-oauth2.html' title='Secure Jersey with OAuth2, Open Authentication Framework'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-7909390765951818447</id><published>2012-06-01T11:28:00.000-07:00</published><updated>2012-06-08T05:57:38.831-07:00</updated><title type='text'>Enable Cross Origin Resource Sharing for Jersey</title><content type='html'>&lt;h2&gt;













Overview &lt;/h2&gt;
In this blog, we will talk about how to enable and configure CORS support for Jersey, and more importantly, how to trouble shoot if CORS is not working properly.&lt;br /&gt;
&lt;br /&gt;
As mentioned in the previous blog, we were disappointed to find out Apache CXF CORS support did not work and were pleasantly surprised on how easy &lt;a href=&quot;http://software.dzhuvinov.com/cors-filter.html&quot;&gt;CORS filte&lt;/a&gt;r has been to setup and configure. We have tested CORS filter against Jersey, RESTeasy, and Apache CXF and it worked for every single one of them.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;













Enable CORS Support&lt;/h2&gt;
CORS filter is implemented as a Servlet that must be enabled and configured at the web app&#39;s level, inside web.xml file.&lt;br /&gt;
Here is a sample web.xml file,&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; id=&quot;WebApp_ID&quot; version=&quot;2.5&quot;&amp;gt;
  &amp;lt;servlet&amp;gt;
    &amp;lt;servlet-name&amp;gt;Jersey Root REST Service&amp;lt;/servlet-name&amp;gt;
    &amp;lt;servlet-class&amp;gt;com.sun.jersey.spi.container.servlet.ServletContainer&amp;lt;/servlet-class&amp;gt;
    &amp;lt;init-param&amp;gt;
      &amp;lt;param-name&amp;gt;com.sun.jersey.config.property.packages&amp;lt;/param-name&amp;gt;
      &amp;lt;param-value&amp;gt;jersey.cors&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
 &amp;lt;init-param&amp;gt;
  &amp;lt;param-name&amp;gt;com.sun.jersey.api.json.POJOMappingFeature&amp;lt;/param-name&amp;gt;
  &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
 &amp;lt;/init-param&amp;gt;
 &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;
  &amp;lt;/servlet&amp;gt;
  &amp;lt;servlet-mapping&amp;gt;
    &amp;lt;servlet-name&amp;gt;Jersey Root REST Service&amp;lt;/servlet-name&amp;gt;
    &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
  &amp;lt;/servlet-mapping&amp;gt;
  &amp;lt;filter&amp;gt;
  &amp;lt;filter-name&amp;gt;CORS&amp;lt;/filter-name&amp;gt;
  &amp;lt;filter-class&amp;gt;com.thetransactioncompany.cors.CORSFilter&amp;lt;/filter-class&amp;gt;
  
  &amp;lt;!-- Note: All parameters are options, if ommitted CORS Filter
       will fall back to the respective default values.
    --&amp;gt;
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.allowGenericHttpRequests&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;
  
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.allowOrigin&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;*&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;
  
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.supportedMethods&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;GET, HEAD, POST, OPTIONS, PUT, DELETE&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;
  
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.supportedHeaders&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;Content-Type, X-Requested-With, Accept, Authentication&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;
  
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.exposedHeaders&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;X-Test-1, X-Test-2&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;
  
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.supportsCredentials&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;
  
  &amp;lt;init-param&amp;gt;
   &amp;lt;param-name&amp;gt;cors.maxAge&amp;lt;/param-name&amp;gt;
   &amp;lt;param-value&amp;gt;3600&amp;lt;/param-value&amp;gt;
  &amp;lt;/init-param&amp;gt;

 &amp;lt;/filter&amp;gt;

 &amp;lt;filter-mapping&amp;gt;
  &amp;lt;!-- CORS Filter mapping --&amp;gt;
  &amp;lt;filter-name&amp;gt;CORS&amp;lt;/filter-name&amp;gt;
  &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
 &amp;lt;/filter-mapping&amp;gt;
  
&amp;lt;/web-app&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;h3&gt;











Configuring CORS Filter&lt;/h3&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;The default configuration values are good for everything except for the following two fields,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;cors.supportedMethods&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;cors.supportedHeaders&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;These two fields must be checked if CORS filter is not working as one expected.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;cors.supportedMethods specifies a list of supported methods and the default value is GET, HEAD, and POST only. We recommend listing all HTTP methods as supported methods.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;cors.supportedHeaders lists the set of supported header fields. This set must be expanded if more headers are passed in unexpected.&amp;nbsp; We recommend listing as many headers as possible.&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;










Testing and Troubleshooting&lt;/h2&gt;
CORS support can be tested through javascript and here is an example,
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;lt;html&amp;gt; 
&amp;lt;head&amp;gt; 
&amp;lt;title&amp;gt;Cors Example&amp;lt;/title&amp;gt; 
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;log4javascript.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt; 
var hello = JSON.stringify({&quot;greeting&quot;:&quot;Hello&quot;,&quot;name&quot;:&quot;jersey&quot;});
//alert(hello);
$(document).ready(function() {

 //alert(&#39;before ajax call&#39;);
 $.ajax({
  headers: {
   Authentication : &#39;Bearer access_token&#39;
  },
  
  //this is the php file that processes the data and send mail
  //url: &quot;http://localhost:8080/cxf-hello-cors/rest/annotatedGet/hello&quot;, 
  //url: &quot;http://localhost:8080/cxf-hello-cors/service1/time&quot;, 
  // url: &quot;http://localhost:8080/resteasy/tutorial/helloworld&quot;,
  url: &quot;http://localhost:8080/jersey/hello&quot;,
  
  contentType: &quot;application/json&quot;,

  //GET method is used
  type: &#39;DELETE&#39;,
  
  //pass the data         
  dataType: &#39;json&#39;,   
   
  //data: JSON.stringify(hello), 
  data: hello,
  
  //Do not cache the page
  cache: false,
   
  //success
  success: function (html) {  
   //alert(html); 
   document.getElementById(&quot;cors&quot;).innerHTML = &quot;Echo: &quot; + html.greeting + &quot;,&quot; + html.name; 
           
  } ,
  error:function (data, status) {
   alert(data);
   alert(status);
     }      
 });
     
 });
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt; 
&amp;lt;body&amp;gt; 

&amp;lt;h1&amp;gt;This is the CORS test page&amp;lt;/h1&amp;gt;

&amp;lt;p&amp;gt;Hello, &amp;lt;div id=&quot;cors&quot;/&amp;gt;

&amp;lt;/body&amp;gt; 
&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;h3&gt;









Troubleshooting CORS&lt;/h3&gt;
We use a combination of Tomcat access log, Firefox Firebug, and Jersey client to troubleshoot CORS support.&lt;br /&gt;
CORS relies on header to relay cross origin&amp;nbsp; resource sharing information back to the browser and CORS-supported browser will enforce CORS based on these header fields. When CORS is not working as expected, the majority of the errors happen when Web Services do not pass back the appropriate headers due to permission related issues, like supported headers or supported methods. The best place to look for this type of information is in Tomcat&#39;s access log.&lt;br /&gt;
Here are some sample entries from the access log,&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;127.0.0.1 - - [31/May/2012:15:40:42 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 401 -
127.0.0.1 - name [31/May/2012:15:42:27 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 200 36
127.0.0.1 - - [31/May/2012:15:42:39 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 401 -
127.0.0.1 - - [31/May/2012:15:44:18 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 401 -
127.0.0.1 - - [31/May/2012:15:45:45 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 401 -
127.0.0.1 - - [31/May/2012:15:46:38 -0400] &quot;GET / HTTP/1.1&quot; 401 -
127.0.0.1 - - [31/May/2012:15:46:52 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 401 -
0:0:0:0:0:0:0:1%0 - - [31/May/2012:15:47:02 -0400] &quot;OPTIONS /jersey/hello HTTP/1.1&quot; 403 94
127.0.0.1 - - [31/May/2012:15:48:06 -0400] &quot;GET / HTTP/1.1&quot; 401 -
0:0:0:0:0:0:0:1%0 - - [31/May/2012:15:51:23 -0400] &quot;OPTIONS /jersey/hello HTTP/1.1&quot; 200 -
0:0:0:0:0:0:0:1%0 - name [31/May/2012:15:51:23 -0400] &quot;DELETE /jersey/hello HTTP/1.1&quot; 200 36
127.0.0.1 - name [31/May/2012:16:01:12 -0400] &quot;GET /jersey/hello HTTP/1.1&quot; 200 36&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
Each entry represents an access from the client. The last three entries represent
the following, request URI, HTTP status code, return content length. If CORS is not
working as expected, check the following,
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Make sure there is an entry in the access log that corresponds to the request&lt;/li&gt;
&lt;li&gt;Make sure HTTP status code is correct. If HTTP status code is 403, check CORS filter&#39;s &lt;br /&gt;supported methods and supported headers to make sure that both settings are configured&lt;br /&gt;properly&lt;/li&gt;
&lt;/ul&gt;
If HTTP code is 200 but CORS is still not working, turn Firebug on and examine the request&lt;br /&gt;
pay special attention to response headers,&lt;br /&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5cNYZ9kLG5ETrB1m12jDGEsM4yvp0UPf81rIxFFkIHOHGFouwHs-YPAZ0bDfcAGihmowdgB35eAiI-Yze9d6_mg43ZNiFMe7xUto8XgAXqqfMx597GQ83wKxOK1FAxLTdwZbrm1hjLvjU/s1600/firebug.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5cNYZ9kLG5ETrB1m12jDGEsM4yvp0UPf81rIxFFkIHOHGFouwHs-YPAZ0bDfcAGihmowdgB35eAiI-Yze9d6_mg43ZNiFMe7xUto8XgAXqqfMx597GQ83wKxOK1FAxLTdwZbrm1hjLvjU/s640/firebug.png&quot; width=&quot;592&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Debugging CORS response with Firebug&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;/ul&gt;
Make sure the set of Access-Control-* headers present in response.</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/7909390765951818447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/enable-cors-for-jersey.html#comment-form' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/7909390765951818447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/7909390765951818447'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/enable-cors-for-jersey.html' title='Enable Cross Origin Resource Sharing for Jersey'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5cNYZ9kLG5ETrB1m12jDGEsM4yvp0UPf81rIxFFkIHOHGFouwHs-YPAZ0bDfcAGihmowdgB35eAiI-Yze9d6_mg43ZNiFMe7xUto8XgAXqqfMx597GQ83wKxOK1FAxLTdwZbrm1hjLvjU/s72-c/firebug.png" height="72" width="72"/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-5582233526290646819</id><published>2012-06-01T10:27:00.000-07:00</published><updated>2012-06-05T13:02:35.527-07:00</updated><title type='text'>Implement RESTful Web Services using Jersey</title><content type='html'>&lt;h2&gt;


















&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;


Jersey Overview&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Jersey is the open source, production quality,&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&lt;a href=&quot;http://jsr311.dev.java.net/nonav/releases/1.1/index.html&quot; style=&quot;color: #3e6b8a; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;&quot;&gt;JAX-RS&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;(JSR 311) Reference Implementation for building RESTful Web services.&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&amp;nbsp;Jersey is very lightweight and can be deployed in Web application containers like Tomcat, Jetty, Glassfish.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;In this blog, we will provide a comprehensive tutorial on how to create a RESTful web services using Jersey, including,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Support for HTTP method, GET, PUT, POST, and DELETE&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Support for various content types including TEXT, XML, and HTML&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;JSON support&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;h2&gt;



















&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Times, &#39;Times New Roman&#39;, serif; font-size: x-large;&quot;&gt;Develop RESTful Web Services using Eclipse&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;We will demonstrate how to develop web services in Jersey using Eclipse. in the following steps,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Create a new Dynamic Web Project in Eclipse&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Import Jersey related libraries&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Configure web.xml to support Jersey&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Create a Java class that implements Web Services&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Deploy web project in Tomcat&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Start Tomcat and test&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;






&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-size: large;&quot;&gt;Configure Tomcat to enable access log logging&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;We need to enable Tomcat to log accesses for easy debugging. Uncomment the following block in Tomcat&#39;s server.xml file,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&amp;lt;Valve className=&quot;org.apache.catalina.valves.AccessLogValve&quot; directory=&quot;logs&quot; pattern=&quot;common&quot; prefix=&quot;localhost_access_log.&quot; resolveHosts=&quot;false&quot; suffix=&quot;.txt&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h3&gt;





Configure web.xml to support Jersey&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;Here is a sample web.xml file, which includes JSON support and auto scanning of Java package jersey.cors. Replace package name &quot;jersey.cors&quot; with one&#39;s own package.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&amp;lt;?xml&amp;nbsp;version=&quot;1.0&quot;&amp;nbsp;encoding=&quot;UTF-8&quot;?&amp;gt;

&amp;lt;web-app&amp;nbsp;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&amp;nbsp;xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;&amp;nbsp;xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&amp;nbsp;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee&amp;nbsp;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&amp;nbsp;id=&quot;WebApp_ID&quot;&amp;nbsp;version=&quot;2.5&quot;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;servlet&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;servlet-name&amp;gt;Jersey&amp;nbsp;Root&amp;nbsp;REST&amp;nbsp;Service&amp;lt;/servlet-name&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;servlet-class&amp;gt;com.sun.jersey.spi.container.servlet.ServletContainer&amp;lt;/servlet-class&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;init-param&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;param-name&amp;gt;com.sun.jersey.config.property.packages&amp;lt;/param-name&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;param-value&amp;gt;jersey.cors&amp;lt;/param-value&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/init-param&amp;gt;
 &amp;lt;init-param&amp;gt;
  &amp;lt;param-name&amp;gt;com.sun.jersey.api.json.POJOMappingFeature&amp;lt;/param-name&amp;gt;
  &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
 &amp;lt;/init-param&amp;gt;
 &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/servlet&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;servlet-mapping&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;servlet-name&amp;gt;Jersey&amp;nbsp;Root&amp;nbsp;REST&amp;nbsp;Service&amp;lt;/servlet-name&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/servlet-mapping&amp;gt;
&amp;lt;/web-app&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;h3&gt;














&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Create a Java Class that Implements Web Services&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;package jersey.cors;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

// POJO, no interface no extends

// The class registers its methods for the HTTP GET request using the @GET annotation. 
// Using the @Produces annotation, it defines that it can deliver several MIME types,
// text, XML and HTML. 

// The browser requests per default the HTML MIME type.

//Sets the path to base URL + /hello
@Path(&quot;/hello&quot;)
public class HelloWorldRest {

 @GET
 @Path(&quot;/{param}/&quot;)
 public String getMsg(@PathParam(&quot;param&quot;) String msg) {
 
  String output = &quot;Jersey say : &quot; + msg;
 
  return output;
 
 }
 @GET
 @Path(&quot;/world&quot;)
 public String getFixedMsg(String msg) {
 
  String output = &quot;Jersey say : fixed path&quot; + msg;
 
  return output;
 
 }
 // This method is called if TEXT_PLAIN is request
 @GET
 //@Path(&quot;helloworld&quot;)
 @Produces(MediaType.TEXT_PLAIN)
 public String sayPlainTextHello() {
  System.out.println(&quot;sayPlain&quot;);
  return &quot;Hello Jersey&quot;;
 }

 // This method is called if XML is request
 @GET
 //@Path(&quot;helloworld&quot;)
 @Produces(MediaType.TEXT_XML)
 public String sayXMLHello() {
  System.out.println(&quot;sayXML&quot;);
  return &quot;&quot; + &quot;&lt;hello&gt; Hello Jersey&quot; + &quot;&lt;/hello&gt;&quot;;
 }

 // This method is called if HTML is request
 @GET
 //@Path(&quot;helloworld&quot;)
 @Produces(MediaType.TEXT_HTML)
 public String sayHtmlHello() {
  System.out.println(&quot;sayHTML&quot;);
  return &quot;&amp;lt;html&amp;gt; &quot; + &quot;&amp;lt;title&amp;gt;&quot; + &quot;Hello Jersey&quot; + &quot;&amp;lt;/title&amp;gt;&quot;
    + &quot;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;&quot; + &quot;Hello Jersey&quot; + &quot;&amp;lt;/body&amp;gt;&amp;lt;/h1&amp;gt;&quot; + &quot;&amp;lt;/html&amp;gt; &quot;;
 }
 
 // This method is called if JSON is request
 @GET
 //@Path(&quot;helloworld&quot;)
 @Produces(MediaType.APPLICATION_JSON)
 public Hello sayJsonHello() {
  return new Hello(&quot;Hello&quot;, &quot;Jersey&quot;);
 }
        @PUT
 @Produces(MediaType.APPLICATION_JSON)
 public Hello updateHello(Hello hello)
 {
  System.out.println(&quot;put&quot;);
  return hello;
 }
 @POST
 @Produces(MediaType.APPLICATION_JSON)
 public Hello createHello(Hello hello)
 {
  System.out.println(&quot;post&quot;);
  return hello;
 }
 @DELETE
 @Produces(MediaType.APPLICATION_JSON)
 public Hello deleteHello(Hello hello)
 {
  System.out.println(&quot;post&quot;);
  return hello;
 } 
 @DELETE
 @Produces(MediaType.TEXT_PLAIN)
 public String deleteHello(String hello)
 {
  System.out.println(&quot;post&quot;);
  return hello;
 } 
}
&lt;/span&gt;&lt;/pre&gt;
Here is the Hello class, which serves as JSON transport object.&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;package jersey.cors;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Hello {
 String greeting;
 String name;
 public Hello()
 {
  
 }
 public Hello(String greeting, String name)
 {
  this.greeting = greeting;
  this.name = name;
 }
 public String getGreeting() {
  return greeting;
 }
 public void setGreeting(String greeting) {
  this.greeting = greeting;
 }
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
 
}&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;h3 style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;








&lt;span style=&quot;font-size: large;&quot;&gt;Testing Web Services&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;After web service project is deployed in Tomcat, we should be able to start Tomcat with no error.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Generally, Web Services can be tested in the following manner,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;HTTP GET method can be tested directly through a browser&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;HTTP GET, PUT, DELETE, and POST can be tested through Java script&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;HTTP GET and POST can be tested through Jersey client. (Due the limitation in Java URLConnection class, it can be challenging to test HTTP PUT and DELETE using Jersey client).&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;




&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Javascript Example&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;Here is an Javascript HTTP DELETE example, with JSON support,
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;lt;html&amp;gt; 
&amp;lt;head&amp;gt; 
&amp;lt;title&amp;gt;Cors Example&amp;lt;/title&amp;gt; 
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;log4javascript.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt; 
var hello = JSON.stringify({&quot;greeting&quot;:&quot;Hello&quot;,&quot;name&quot;:&quot;jersey&quot;});
//alert(hello);
$(document).ready(function() {

 //alert(&#39;before ajax call&#39;);
 $.ajax({
  headers: {
   Authentication : &#39;Bearer access_token&#39;
  },
  
  //this is the php file that processes the data and send mail
  //url: &quot;http://localhost:8080/cxf-hello-cors/rest/annotatedGet/hello&quot;, 
  //url: &quot;http://localhost:8080/cxf-hello-cors/service1/time&quot;, 
  // url: &quot;http://localhost:8080/resteasy/tutorial/helloworld&quot;,
  url: &quot;http://localhost:8080/jersey/hello&quot;,
  
  contentType: &quot;application/json&quot;,

  //GET method is used
  type: &#39;DELETE&#39;,
  
  //pass the data         
  dataType: &#39;json&#39;,   
   
  //data: JSON.stringify(hello), 
  data: hello,
  
  //Do not cache the page
  cache: false,
   
  //success
  success: function (html) {  
   //alert(html); 
   document.getElementById(&quot;cors&quot;).innerHTML = &quot;Echo: &quot; + html.greeting + &quot;,&quot; + html.name; 
           
  } ,
  error:function (data, status) {
   alert(data);
   alert(status);
     }      
 });
     
 });
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt; 
&amp;lt;body&amp;gt; 

&amp;lt;h1&amp;gt;This is the CORS test page&amp;lt;/h1&amp;gt;

&amp;lt;p&amp;gt;Hello, &amp;lt;div id=&quot;cors&quot;/&amp;gt;

&amp;lt;/body&amp;gt; 
&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;




&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Jersey Client Example&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here is a HTTP GET Jersey client example,
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;package jersey.cors.client;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
 
public class JerseyClient {
 
  public static void main(String[] args) {
 try {
 
  Client client = Client.create();
 
  WebResource webResource = client
     .resource(&quot;http://localhost:8080/jersey/hello&quot;);
  
  ClientResponse response = webResource.accept(&quot;application/json&quot;)
                   .get(ClientResponse.class);
 
  if (response.getStatus() != 200) {
     throw new RuntimeException(&quot;Failed : HTTP error code : &quot;
   + response.getStatus());
  }
 
  String output = response.getEntity(String.class);
 
  System.out.println(&quot;Output from Server .... \n&quot;);
  System.out.println(output);
 
   } catch (Exception e) {
 
  e.printStackTrace();
 
   }
 
 }
}
&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;








&amp;nbsp;&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/5582233526290646819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/introduction-to-jersey.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/5582233526290646819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/5582233526290646819'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/06/introduction-to-jersey.html' title='Implement RESTful Web Services using Jersey'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-6283041171472776012</id><published>2012-05-31T13:56:00.000-07:00</published><updated>2012-06-06T11:22:36.214-07:00</updated><title type='text'>Build secure, cross-origin resource sharing RESTful web services using Jersey, CORS filter, and OAuth</title><content type='html'>&lt;h4&gt;




Overview&lt;/h4&gt;
&lt;div&gt;
My company is taking on the challeng of building out next generation platform based on secure RESTful web services, which must be secured through OAuth and support Cross-Origin Resource Sharing (CORS).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Web Services can be implemented as SOAP and WSDL based or RESTful based. Our new platform will be implemented as RESTful based web service.&lt;br /&gt;
&lt;br /&gt;
Our new platform also needs to support Cross Origin Resource Sharing, which allows third party Javascript to call our platform without being restricted to the same domain. Traditionally the browser enfoces that an AJAX can only call back to the same domain. For CORS supported browser, however, the
browser can grant cross domain access if proper access is returned by the back end web services.&lt;/div&gt;
&lt;br /&gt;
Our platform must be secure. After some initial investigation, we decided to go with OAuth2, the next generation of OAuth protocol. The OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers. More generally, OAuth creates a freely-implementable and generic methodology for API authentication.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
After some research and prototyping, we settle on the following set of technologies to address our particular challenges;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Use Jersey to implement RESTful web services&lt;/li&gt;
&lt;li&gt;Use CORS filter to implement CORS support&lt;/li&gt;
&lt;li&gt;Implement and deploy on Tomcat OAuth valve class for OAuth support&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
In this blog series, we will illustrate the following,&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;How we picked this set of technologies&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/06/introduction-to-jersey.html&quot;&gt;Implement Web Services using Jersey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/06/enable-cors-for-jersey.html&quot;&gt;Enable Cross Origin Resource Sharing for Jersey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/06/secure-jersey-with-oauth2.html&quot;&gt;Enable OAuth support for Jersey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/06/how-to-use-apache-httpclient-4-library.html&quot;&gt;How to securely call web services using Apache HttpClient 4 library&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
















How we picked this set of technologies&lt;/h4&gt;
&lt;/div&gt;
&lt;h2&gt;
















RESTful Web Services Framework&lt;/h2&gt;
&lt;div&gt;
The initial candidates consist of three JAX-RS compliant RESTful Web Services framework,&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;tr&quot;&gt;
&lt;/tr&quot;&gt;&lt;br /&gt;
&lt;table border=&quot;2&quot; bordercolor=&quot;#0033FF&quot; cellpadding=&quot;3&quot; cellspacing=&quot;3&quot; style=&quot;background-color: #99ffff;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;RESTful Framework&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Experience&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jersey&lt;/td&gt;
&lt;td&gt;Jersey is the JAX-RS reference&lt;br /&gt;
implementation
from Oralce.
One&lt;br /&gt;
chooses between CDDL 1.1 license&lt;br /&gt;
or
GPL 2 with CPE license&lt;/td&gt;&lt;td&gt;Easy to develop and configure.&lt;br /&gt;
Has good JSON support.&lt;br /&gt;
No external dependency, although&lt;br /&gt;
does offer Spring integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JBoss RESTeasy&lt;/td&gt;
&lt;td&gt;RESTeasy is maintained by Jobs&lt;br /&gt;
and uses
Apache 2.0 license&lt;/td&gt;
&lt;td&gt;Easy to develop with a lot of&lt;br /&gt;
JBoss dependencies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Apache CXF&lt;/td&gt;
&lt;td&gt;Apache CXF offers both WSDL-based&lt;br /&gt;
and
RESTful web services and uses&lt;br /&gt;
Apache 2.0
license&lt;/td&gt;
&lt;td&gt;Easy to develop, heavy&lt;br /&gt;
framework with a lot of&lt;br /&gt;
dependencies and support for&lt;br /&gt;
JAX-WS&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
We prototyped in all three frameworks and they are all relatively easy to develop and configure. We decided to go with Jersey for the following reasons,&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Reference implementation&lt;/li&gt;
&lt;li&gt;Small set of libraries&lt;/li&gt;
&lt;li&gt;No external dependency&lt;/li&gt;
&lt;li&gt;Can easily switch if Jersey does not meet our needs in the future&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;










Migrate to another framework&lt;/h3&gt;
&lt;div&gt;
Since all three frameworks are JAX-RS compliant, the implementation classes use JAX-RS standard annotation and there is no direct dependency on the framework. If we need to swamp out Jersey with another framework, we just need to configure Tomcat web application&#39;s web.xml with framework specific configuration and deploy framework specific libraries to the lib directory.&lt;/div&gt;
&lt;h2&gt;
















CORS Support&lt;/h2&gt;
&lt;div&gt;
We prototyped CORS support based on the following frameworks, &lt;a href=&quot;http://cxf.apache.org/docs/jax-rs-cors.html&quot;&gt;CXF CORS support &lt;/a&gt;and &lt;a href=&quot;http://software.dzhuvinov.com/cors-filter.html&quot;&gt;CORS filter&lt;/a&gt;. We couldn&#39;t get CXF CORS to even compile, as the class structure has changed from the sample code. Once we fixed the compilation issue, we still couldn&#39;t get CORS to work through AJAX.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
CORS filter, on the other hand, was a pleasure to work with. In a span of half a day, we quickly set up and integrated CORS filter with Jersey, RESTeasy, and CXF. The only drawback about CORS filter is that it is not as flexible as CXF CORS because CORS filter can only be configured at the global level, while CXF CORS can be configured at each class level, if one can get CXF CORS to work.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
So, I decide to go with CORS filter as the one and only working solution.&lt;/div&gt;
&lt;h2&gt;
















OAuth Support&lt;/h2&gt;
&lt;div&gt;
All our RESTful web services must be secured with OAuth support. There are potentially a few options on how to implement this and in the end we decided to implement this a Tomcat Valve instead of using a security realm or a servlet filter. The big advantage of implementing OAuth as a Valve is the flexibility of deploying the Valve at the Host level or at the web application level, while servlet filter can only be deployed at the web application level. More on this topic in a later blog.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/6283041171472776012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/05/build-secure-cross-origin-resource.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/6283041171472776012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/6283041171472776012'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/05/build-secure-cross-origin-resource.html' title='Build secure, cross-origin resource sharing RESTful web services using Jersey, CORS filter, and OAuth'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-21206846272997024</id><published>2012-03-06T06:26:00.000-08:00</published><updated>2012-03-06T06:29:24.160-08:00</updated><title type='text'>SCTE-130 vs IAB VAST (part II)</title><content type='html'>In the previous &lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/03/scte-130-vs-iab-vast-part-i.html&quot;&gt;blog&lt;/a&gt;, I expanded on the major differences between SCTE-130 and IAB VAST.&lt;br /&gt;
&lt;div&gt;
In this blog, I will continue examine the rest of the major differences between SCTE-130 and IAB VAST.&lt;/div&gt;
&lt;div&gt;
In the fourth and final installment, I will discuss the upcoming convergence of advertising decision making between the online and cable deployment and how it presents an compelling business opportunity to bridge the gap between SCTE-130 and IAB VAST.&lt;br /&gt;
&lt;br /&gt;
I will discuss the key different between two standards in the following areas, &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Type and Interactivity with Ads&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Complexity&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Protocol Format&amp;nbsp;&lt;/li&gt;
&lt;li&gt;When to Play Ads&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Deployment, Serving Ads, and Tracking Playback events&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Targeting and Addressability&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Report gathering to improve addressability&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Measurement and Operational Efficiency Best Practices&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
In this blog, I will discuss the last five areas.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt; Deployment, Serving Ads and Tracking Playback Events&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Ad Ingest&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Unlike the online world, where videos can be served from CDN and consumed by video player directly, an ad must be ingested, transcoded, moved to CDN or onto the video server’s local storage, before the ad can be streamed to setup boxes.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Since ADS is an independent component, ADS will not play an ad until the ADS is sure that particular ad has been ingested and moved to storage where it can be streamed by video servers.&lt;br /&gt;
&lt;br /&gt;
When an ad has been fully ingested, the ingest process will notify all subscribing ADSs through CIS notification interface that this particular ad can be placed during an ad break.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Response&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
IAB VAST response contains direct links to videos, banners, and overlays, which can be downloaded and played by the video player directly.&lt;br /&gt;
&lt;br /&gt;
SCTE-130 response, on the other hand, contains asset and provider ids, information that will be used to identify the actual ingested ad video files to play by the video server.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Deployment&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
The Ad server is typically deployed on a publicly accessible network and videos and images are deployed on a public accessible CDN.&lt;br /&gt;
&lt;br /&gt;
In SCTE-130 world, most components will be deployed in MSO’s central sites (session manager, SIS, CIS, POIS, ADS), and some (ADM, video server, splicer) will be deployed on the edge sites.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Serving Ads and Tracking Playback Events&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt; IAB VAST&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
In the online world, ads are hosted on a CDN, streamed by either a media server or Apache server. The video player is responsible for sending playback events to the Ad server at the appropriate event (video start play, first quartile, midpoint, third quartile, and complete) in real time.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;b&gt;SCTE-130&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
In the cable world, ads can be hosted on a CDN or shared storage and streamed by a video server. The playback tracking events are handled differently for VOD and for linear Ad insertion.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;VOD&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
For VOD insertion, setup box communicates user’s activities (pause, fast forward, etc) to the streaming video server. Video server collects user’s activities for the entire playlist (content and Ads) and uploads the entire playback events to ADM at the end.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;LINEAR&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;For linear ad insertion,  ADM collects playback events from the splicer and the streaming video server and the combined results will determine the success or failure of the ad insertion. The playback event is then sent to ADS.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt; Targeting and Addressability&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
SCTE-130 provides the following mechanism for targeting and addressability,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Subscriber Information System (SIS), a standard interface that exposes subscriber’s demographic and geographic information&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A standard way of passing any targeting-related information from ADM to ADS&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
IAB VAST does not define such standard and relies on each Ad server to define its own Ad tags.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Report gathering to improve addressability&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Report gathering and analysis is relative straightforward, as the video player will report playback tracking information back to the Ad server directly. The Ad server can mine this data and improve addressability based on user&#39;s interaction with the ad.&lt;br /&gt;
&lt;br /&gt;
Report gathering for SCTE-130, on the other hand, can be challenging because of the inherited complexity and multiple systems involved. Video server will report back playback information to ADS through ADM for billing purpose but this information really needs to go back to Subscriber Information System (SIS) in order to improve future addressability.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Measurements and Operational Efficiency Best Practices&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
IAB offers set of comprehensive guidelines on measurements and operational efficiency best practices.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Digital Video&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
IAB VAST publishes the following guideline for digital video advertising,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Digital Video In-Stream Ad Metrics Definitions&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Digital Video Ad Measurement Guidelines&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Digital Video Ad Format Guidelines &amp;amp; Best Practices&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;i&gt; Measurement Guidelines&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
IAB publishes measurement guidelines for the following,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Ad Impression&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Ad Campaign&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Ad Verification&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Audience Reach&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Click&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Digital Video Ad&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Mobile Web Advertising&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Rich Media&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Rich Internet Application&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;i&gt; Operational Efficiency Best Practices&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
IAB publishes the following operational efficiency best practices,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Ad Load Performance&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Rich Media Ads in Asynchronous Ad Environment&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Billing Methods&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Impression Exchange Solutions&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Interactive Advertising Workflow&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Interactive Campaign Setup&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Revenue Cycle&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/21206846272997024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/03/scte-130-vs-iab-vast-part-ii.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/21206846272997024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/21206846272997024'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/03/scte-130-vs-iab-vast-part-ii.html' title='SCTE-130 vs IAB VAST (part II)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-1671580043918498394</id><published>2012-03-04T18:09:00.001-08:00</published><updated>2012-03-04T18:28:30.364-08:00</updated><title type='text'>SCTE-130 vs. IAB VAST (Part I)</title><content type='html'>In the previous &lt;a href=&quot;http://2rdscreenretargeting.blogspot.com/2012/02/primer-on-scte-130-and-iab-vast.html&quot;&gt;blog&lt;/a&gt;, I gave a brief introduction to
SCTE-130 and IAB VAST. In this blog and next, I will expand on the major
differences between SCTE-130 and IAB VAST. In the fourth and final installment,
I will discuss the upcoming convergence of advertising decision making between
the online and cable deployment and how it presents an interesting business opportunity
to bridge the gap between SCTE-130 and IAB VAST.&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I will discuss the key different between two standards in
the following areas,&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Type and Interactivity with Ads&lt;/li&gt;
&lt;li&gt;Complexity&lt;/li&gt;
&lt;li&gt;Protocol Format&lt;/li&gt;
&lt;li&gt;When to Play Ads&lt;/li&gt;
&lt;li&gt;Deployment, Serving Ads, and Tracking Playback
events&lt;/li&gt;
&lt;li&gt;Targeting and Addressability&lt;/li&gt;
&lt;li&gt;Report gathering to improve addressability&lt;/li&gt;
&lt;li&gt;Measurement and Operational Efficiency Best Practices&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In this blog, I will discuss the first three areas.&lt;/div&gt;
&lt;h1&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Type and Interactivity with Ads&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
SCTE-130 standard is video centric and relies on EBIF
standard to provide interactivity with ads through setup box.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
IAB VAST standard supports video, interactive ads, banners,
and overlays. IAB defines video player’s interactivity with ads through IAB
VPAID standard.&lt;/div&gt;
&lt;h1&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Complexity&lt;/span&gt;&lt;/h1&gt;
&lt;h3&gt;





IAB VAST&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The IAB VAST standard defines the correspondence between a
video player and Ad servers. Here are the components in an IAB VAST deployment,&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l1 level1 lfo4; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Millions of online video players&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l1 level1 lfo4; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Ad servers &lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l1 level1 lfo4; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;CDN that hosts videos, images, Flash files,
Silverlight files&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l1 level1 lfo4; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Media servers or Apache servers&lt;/div&gt;
&lt;h3&gt;





SCTE-130&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
On the other hand, SCTE-130 standard consists of the
following core components,&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Ad Management Service (ADM)&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Ad Decision Service (ADS)&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Placement Opportunity Information System (POIS)&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Content Information System (CIS)&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo2; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;Subscriber Information System (SIS)&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Each core components can be developed and deployed
independently, and most times they are from different vendors.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
To add to the complexity, these core components need to communicate
with the following external systems to carry out the Ad insertion,&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid white 1.0pt; mso-border-insideh: .75pt solid white; mso-border-insidev: .75pt solid white; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 3.0pt; border: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Systems&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 3.0pt; border-left: none; border-right: solid white 1.0pt; border-top: solid white 1.0pt; mso-border-left-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 3.0pt; border-left: none; border-right: solid white 1.0pt; border-top: solid white 1.0pt; mso-border-left-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;SCTE-130 Core Components&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 1;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: none; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: none; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Session Manager&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #A7BFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white 1.0pt; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Session Manager is responsible for setting up video
  sessions on behalf of the setup box&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #A7BFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white 1.0pt; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
ADM&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 2;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: none; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: solid white 1.0pt; mso-border-left-alt: solid white 1.0pt; mso-border-right-alt: solid white 3.0pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Video Server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #D3DFEE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-alt: solid white .75pt; mso-border-left-alt: solid white .75pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Video Server streams/broadcast videos to setup box&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #D3DFEE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-alt: solid white .75pt; mso-border-left-alt: solid white .75pt; mso-border-right-alt: solid white 1.0pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
ADM&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 3; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: none; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Splicer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #A7BFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white 1.0pt; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
A piece of equipment that can perform frame-accurate ad
  splicing into network broadcast streams &lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #A7BFDE; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white 1.0pt; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 159.6pt;&quot; valign=&quot;top&quot; width=&quot;213&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
ADM&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
All these systems must work together to carry an ad
insertion event and this is the challenge SCTE-130 attempts to address. This is
why SCTE-130 is such a complicated and overarching standard.&lt;/div&gt;
&lt;h1&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Protocol Format&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Both SCTE-130 and IAB VAST use XML based protocol. However,
IAB VAST does not define a standard request message, only suggested Ad tags
that describes duration, player format, height, width, bandwidth, and supported
downloading method. SCTE-130, on the other hand, uses XML as both request and
response messages.&lt;/div&gt;
&lt;h1&gt;





&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;When to Play Ads&lt;/span&gt;&lt;/h1&gt;
&lt;h3&gt;





SCTE-130&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In cable deployment environment for VOD content, the session
manager will request the entire playlist with Ads filled in from ADM during the
session setup time. A SCTE-130 playlist response looks like the following,
assuming VOD content has no embedded Ads in it,&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Play
pre-roll Ad video1 (30 seconds)&lt;/li&gt;
&lt;li&gt;Play
pre-roll Ad video2 (30 seconds)&lt;/li&gt;
&lt;li&gt;Play
VOD content 0-30 minutes&lt;/li&gt;
&lt;li&gt;Play
mid-roll Ad video3 (30 seconds)&lt;/li&gt;
&lt;li&gt;Play
mid-roll Ad video4 (30 seconds)&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&lt;/span&gt;Play
VOD content 30-60 minutes (end of the content)&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&lt;/span&gt;Play
post-roll Ad video5 (30 seconds)&lt;/li&gt;
&lt;li&gt;Play
post-roll Ad video6 (30 seconds)&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Clearly SCTE-130 response contains information on when to
play ads. When the session manager receives the playlist, the session manager
will hand over the playlist to the video server, which will stream the content
and ads to the subscriber.&lt;/div&gt;
&lt;h3&gt;





IAB VAST&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
IAB VAST standard does not contain information on when to
play ads so it is up to the player or a different standard (MAST) to decide
when to play the returned ads. Typically the VAST response is played right away
by the player. In contrast to cable deployment scenario, where the entire
playlist is constructed at the beginning of the playback, the online video
player must be aware of each ad break in the VOD or linear content and makes
IAB VAST request and plays VAST response at the appropriate ad break time.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/1671580043918498394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/03/scte-130-vs-iab-vast-part-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1671580043918498394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1671580043918498394'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/03/scte-130-vs-iab-vast-part-i.html' title='SCTE-130 vs. IAB VAST (Part I)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-3816505559673994338</id><published>2012-02-26T13:28:00.000-08:00</published><updated>2012-02-27T12:30:19.225-08:00</updated><title type='text'>A Primer on SCTE-130 and IAB VAST</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In the past year, I have been involved in building next
generation advertising solutions based on SCTE-130 and IAB VAST standard. I
have been asked countless times of what these standards are for and how they have
been adopted. This blog is my attempt to give a brief introduction to SCTE-130
and IAB VAST, discuss how each standard is adopted in today’s advertising
industry. In a second blog, I will discuss how these standards are different
and discuss the possible convergence of both standards.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h1&gt;





SCTE-130&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;h2&gt;





What is SCTE-130&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
SCTE-130 is a standard from The Society of Cable
Telecommunications Engineers (SCTE) aiming to build a unified platform for
addressable advertising. SCTE-130 standard consists of a set of XML based
protocols and will work in traditional cable deployment, i.e. setup boxes, for
both linear and VOD programming.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;





Core Elements in SCTE-130&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
SCTE-130 consists of the following core elements and each of
them plays a crucial part in selecting, playing, and tracking an ad.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid white 1.0pt; mso-border-insideh: .75pt solid white; mso-border-insidev: .75pt solid white; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 3.0pt; border: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Core Element&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 3.0pt; border-left: none; border-right: solid white 1.0pt; border-top: solid white 1.0pt; mso-border-left-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;What does it do?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 1;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: none; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: none; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Ad Management Service (ADM)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white 1.0pt; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Initiating ad insertion request to ADS&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Reporting activity events (whether ad was successfully
  placed, if the ad was skipped, etc)&lt;span style=&quot;text-transform: uppercase;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 2;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: none; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: solid white 1.0pt; mso-border-left-alt: solid white 1.0pt; mso-border-right-alt: solid white 3.0pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Ad Decision service (ADS)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-alt: solid white .75pt; mso-border-left-alt: solid white .75pt; mso-border-right-alt: solid white 1.0pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Deciding which ad to play&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 3;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: none; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Content Information System
  (CIS)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white 1.0pt; mso-border-top-alt: solid white 1.0pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Storing availability of an ad&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 4;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-right: solid white 3.0pt; border: solid white 1.0pt; mso-border-bottom-alt: .75pt; mso-border-color-alt: white; mso-border-left-alt: 1.0pt; mso-border-right-alt: 3.0pt; mso-border-style-alt: solid; mso-border-top-alt: .75pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Placement Opportunity
  Information System (POIS)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-alt: solid white .75pt; mso-border-left-alt: solid white .75pt; mso-border-right-alt: solid white 1.0pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Storing the opportunities to place an ad&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr style=&quot;mso-yfti-irow: 5; mso-yfti-lastrow: yes;&quot;&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 1.0pt; border-left: solid white 1.0pt; border-right: solid white 3.0pt; border-top: none; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: white;&quot;&gt;Subscriber Information System
  (SIS)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;background: #4F81BD; border-bottom: solid white 1.0pt; border-left: none; border-right: solid white 1.0pt; border-top: none; mso-border-left-alt: solid white .75pt; mso-border-top-alt: solid white .75pt; padding: 0in 5.4pt 0in 5.4pt;&quot; valign=&quot;top&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
Storing subscriber related information, like demographic,
  geographic information&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;





Who services Ads&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Once a decision has been made on what ads to insert, the insertion
device will insert the ads in the right place and will report back the activity
events (whether ad was successfully placed, how much of the ad was viewed, paused,
skipped, etc) to ADM.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;





Basic Flow for Ad Placement Decision and Tracking&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In the following section, we will show the basic flow for
two different types of ad insertions, VOD and schedule-based linear ad
insertion. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h3&gt;





VOD Ad Insertion&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIMIUOaXaI323tzYYc2pCa8YDeNSYiAwEH5T7jFaFWy_4SG4ahISrlg9XumKLKBv1TFTbwYm1DbNv5bbomG3vzBtYcQJ3hnDT6H9vPUtAZJp-HNVFdlk31ip5tovC4XMxcDSKAbK-uyB8o/s1600/vod.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;387&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIMIUOaXaI323tzYYc2pCa8YDeNSYiAwEH5T7jFaFWy_4SG4ahISrlg9XumKLKBv1TFTbwYm1DbNv5bbomG3vzBtYcQJ3hnDT6H9vPUtAZJp-HNVFdlk31ip5tovC4XMxcDSKAbK-uyB8o/s640/vod.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;





Schedule-based Linear Ad Insertion&lt;o:p&gt;&lt;/o:p&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Linear Ad insertion is typically based on a schedule that
contains what Ad to play within a specific time window on a particular channel.
For example, when an Ad placement opportunity comes in between 7-7:30 PM, play
the soda ad.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh93WVQ6G_2RJS3XFw3udnv_qBiPGRocInGKY8mdLXbGVInV1sXeByK-2vnoY-JB41h78a_uDOTP79NGciYe0dEurU5Cu6nbU_3rongNCgjwjmZybVVPHK4fLQ2yD3BO_g6OJX3Xg4NS-Wm/s1600/schedule-based-ad-insertion.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh93WVQ6G_2RJS3XFw3udnv_qBiPGRocInGKY8mdLXbGVInV1sXeByK-2vnoY-JB41h78a_uDOTP79NGciYe0dEurU5Cu6nbU_3rongNCgjwjmZybVVPHK4fLQ2yD3BO_g6OJX3Xg4NS-Wm/s640/schedule-based-ad-insertion.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;





IAB VAST&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The Interactive Advertising Bureau (IAB) is comprised of
more than 500 leading media and technology companies that are responsible for
selling 86% of online Advertising in the United States.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;





What is IAB VAST&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
IAB’s Digital Video Ad Serving Template (VAST) is designed
to standardize the communication protocol between online video player and Ad
services.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;





What is in IAB VAST&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Defines
     a standard ad response for in-stream video&lt;/li&gt;
&lt;li&gt;Includes
     guidance for most on-demand video players (i.e., Adobe’s Flash, Microsoft’s
     Silverlight and Real Player)&lt;/li&gt;
&lt;li&gt;Includes accommodations for linear video
     and interactive ads (e.g.”pre-roll”) as well as non-linear ads such as
     clickable banners and overlays&lt;/li&gt;
&lt;li&gt;How to track ad playback&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;





Who serves Ads&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Online video player (Flash or Silverlight) is the one that
carries out the actual Ad insertion.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h2&gt;





Basic Flow for Ad Placement Decision and Tracking&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSpLz1kG7X8daA8IN3L0BiYsn1LCbD6uOcudldPPMZKq0dNkcvWQlTXAs6HvLnBhwllXDtzBRuMQ1Ch7APfy8feyk_beea4aCgrZUuO3jj-bb9fh3HEFISyUZFrbgLZWzpfH11TOR0Ezlg/s1600/vast.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;384&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSpLz1kG7X8daA8IN3L0BiYsn1LCbD6uOcudldPPMZKq0dNkcvWQlTXAs6HvLnBhwllXDtzBRuMQ1Ch7APfy8feyk_beea4aCgrZUuO3jj-bb9fh3HEFISyUZFrbgLZWzpfH11TOR0Ezlg/s640/vast.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;





What is not in IAB VAST &lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In contrast to SCTE-130 standard, IAB VAST defines what Ads
to play, but not when to play it. It is up to the player to decide when to
insert the Ads. The Media Abstract Sequencing Template (MAST) format
specification proposed by Akamai is an attempt to address the sequencing of
in-stream advertising content.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In short, VAST standard defines what Ads to play and MAST
standard defines when to play Ads.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
MAST has been widely supported by Flash Strobe Media
Framework as well Microsoft Silverlight Media Framework.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/3816505559673994338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/02/primer-on-scte-130-and-iab-vast.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/3816505559673994338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/3816505559673994338'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/02/primer-on-scte-130-and-iab-vast.html' title='A Primer on SCTE-130 and IAB VAST'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIMIUOaXaI323tzYYc2pCa8YDeNSYiAwEH5T7jFaFWy_4SG4ahISrlg9XumKLKBv1TFTbwYm1DbNv5bbomG3vzBtYcQJ3hnDT6H9vPUtAZJp-HNVFdlk31ip5tovC4XMxcDSKAbK-uyB8o/s72-c/vod.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-679068030804153090.post-1876800986351992937</id><published>2012-02-24T12:08:00.000-08:00</published><updated>2012-02-24T12:15:09.614-08:00</updated><title type='text'>Hadoop 1.0 Quick Start Update</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: x-large;&quot;&gt;Purpose&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;There seems to be quite a few changes in Hadoop 1.0, which was not reflected in Hadoop&#39;s official setup &lt;a href=&quot;http://hadoop.apache.org/common/docs/stable/single_node_setup.html&quot;&gt;guide&lt;/a&gt;. This document attempts to supplement Hadoop&#39;s setup guide, with updates for version 1.0.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;Please follow the official Hadoop setup guide first and then check the specific sections for 1.0 update.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: large;&quot;&gt;Standalone Operations&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;In Hadoop 1.0, all configuration files have been moved to etc/hadoop directory.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;The following example copies the unpacked&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&lt;span class=&quot;codefrag&quot;&gt;conf&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&amp;nbsp;directory to use as input and then finds and displays every match of the given regular expression. Output is written to the given&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&lt;span class=&quot;codefrag&quot;&gt;output&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small; line-height: 15px;&quot;&gt;&amp;nbsp;directory.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;codefrag&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ mkdir input&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;codefrag&quot;&gt;$ cp etc/hadoop/*.xml input&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;codefrag&quot;&gt;$ bin/hadoop jar share/hadoop/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small; line-height: 15px;&quot;&gt;hadoop-examples-*.jar grep input output &#39;dfs[a-z.]+&#39;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small; line-height: 15px;&quot;&gt;&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;codefrag&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$ cat output&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Execution&lt;/span&gt;&lt;br /&gt;
Start the hadoop daemons:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;$ sbin/start-all.sh&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Helvetica, sans-serif; font-size: 13px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;line-height: 15px; margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
Copy the input files into the distributed filesystem:&lt;br /&gt;
&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 14px;&quot;&gt;$ bin/hadoop fs -put etc/hadoop/ input&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 15px; margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
Run some of the examples provided:&lt;br /&gt;
&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 14px;&quot;&gt;$ bin/hadoop jar share/hadoop/hadoop-examples-*.jar grep input output &#39;dfs[a-z.]+&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 15px; margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
Should see something like this:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:04 INFO mapred.FileInputFormat: Total input paths to process : 16&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:05 INFO mapred.JobClient: Running job: job_201202231031_0001&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:06 INFO mapred.JobClient: &amp;nbsp;map 0% reduce 0%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:19 INFO mapred.JobClient: &amp;nbsp;map 12% reduce 0%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:28 INFO mapred.JobClient: &amp;nbsp;map 25% reduce 0%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:34 INFO mapred.JobClient: &amp;nbsp;map 25% reduce 4%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:37 INFO mapred.JobClient: &amp;nbsp;map 37% reduce 4%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:40 INFO mapred.JobClient: &amp;nbsp;map 37% reduce 8%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:43 INFO mapred.JobClient: &amp;nbsp;map 50% reduce 8%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:50 INFO mapred.JobClient: &amp;nbsp;map 56% reduce 12%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:53 INFO mapred.JobClient: &amp;nbsp;map 62% reduce 12%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:56 INFO mapred.JobClient: &amp;nbsp;map 68% reduce 18%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:48:58 INFO mapred.JobClient: &amp;nbsp;map 75% reduce 22%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:01 INFO mapred.JobClient: &amp;nbsp;map 81% reduce 22%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:04 INFO mapred.JobClient: &amp;nbsp;map 87% reduce 22%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:07 INFO mapred.JobClient: &amp;nbsp;map 93% reduce 27%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:10 INFO mapred.JobClient: &amp;nbsp;map 100% reduce 27%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:13 INFO mapred.JobClient: &amp;nbsp;map 100% reduce 29%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:20 INFO mapred.JobClient: &amp;nbsp;map 100% reduce 100%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: Job complete: job_201202231031_0001&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: Counters: 30&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; Job Counters&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Launched reduce tasks=1&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; SLOTS_MILLIS_MAPS=99019&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Total time spent by all reduces waiting after reserving slots (ms)=0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Total time spent by all maps waiting after reserving slots (ms)=0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Launched map tasks=16&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Data-local map tasks=16&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; SLOTS_MILLIS_REDUCES=60471&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; File Input Format Counters&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Bytes Read=26852&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; File Output Format Counters&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Bytes Written=180&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; FileSystemCounters&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; FILE_BYTES_READ=82&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; HDFS_BYTES_READ=28574&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; FILE_BYTES_WRITTEN=367327&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; HDFS_BYTES_WRITTEN=180&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; Map-Reduce Framework&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map output materialized bytes=172&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map input records=758&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce shuffle bytes=166&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Spilled Records=6&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map output bytes=70&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Total committed heap usage (bytes)=2596864000&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; CPU time spent (ms)=12500&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map input bytes=26852&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; SPLIT_RAW_BYTES=1722&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Combine input records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce input records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce input groups=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Combine output records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Physical memory (bytes) snapshot=2788790272&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce output records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Virtual memory (bytes) snapshot=9619705856&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map output records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.FileInputFormat: Total input paths to process : 1&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:25 INFO mapred.JobClient: Running job: job_201202231031_0002&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:26 INFO mapred.JobClient: &amp;nbsp;map 0% reduce 0%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:41 INFO mapred.JobClient: &amp;nbsp;map 100% reduce 0%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:53 INFO mapred.JobClient: &amp;nbsp;map 100% reduce 100%&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: Job complete: job_201202231031_0002&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: Counters: 30&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; Job Counters&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Launched reduce tasks=1&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; SLOTS_MILLIS_MAPS=13874&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Total time spent by all reduces waiting after reserving slots (ms)=0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Total time spent by all maps waiting after reserving slots (ms)=0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Launched map tasks=1&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Data-local map tasks=1&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; SLOTS_MILLIS_REDUCES=10575&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; File Input Format Counters&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Bytes Read=180&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; File Output Format Counters&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Bytes Written=52&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; FileSystemCounters&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; FILE_BYTES_READ=82&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; HDFS_BYTES_READ=296&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; FILE_BYTES_WRITTEN=42387&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; HDFS_BYTES_WRITTEN=52&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; Map-Reduce Framework&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map output materialized bytes=82&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map input records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce shuffle bytes=82&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Spilled Records=6&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map output bytes=70&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Total committed heap usage (bytes)=220725248&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; CPU time spent (ms)=1990&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map input bytes=94&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; SPLIT_RAW_BYTES=116&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Combine input records=0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce input records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce input groups=1&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Combine output records=0&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Physical memory (bytes) snapshot=235311104&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Reduce output records=3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Virtual memory (bytes) snapshot=1171832832&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 15px;&quot;&gt;12/02/23 16:49:58 INFO mapred.JobClient: &amp;nbsp; &amp;nbsp; Map output records=3&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
Examine output.&lt;/div&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
Copy the output files from the distributed filesystem to the local filesytem and examine them:&lt;/div&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 14px;&quot;&gt;$ bin/hadoop fs -get output output&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 15px;&quot;&gt;
&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 14px;&quot;&gt;$ cat output/*&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;line-height: 15px; margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
or&lt;/div&gt;
&lt;div style=&quot;line-height: 15px; margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
View the output files on the distributed filesystem:&lt;br /&gt;
&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 14px;&quot;&gt;$ bin/hadoop fs -cat output/*&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 15px; margin-bottom: 1em; margin-top: 0.5em; text-align: left;&quot;&gt;
When you&#39;re done, stop the daemons with:&lt;br /&gt;
&lt;span class=&quot;codefrag&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 14px;&quot;&gt;$ sbin/stop-all.sh&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://2rdscreenretargeting.blogspot.com/feeds/1876800986351992937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/02/hadoop-10-quick-start-update.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1876800986351992937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/679068030804153090/posts/default/1876800986351992937'/><link rel='alternate' type='text/html' href='http://2rdscreenretargeting.blogspot.com/2012/02/hadoop-10-quick-start-update.html' title='Hadoop 1.0 Quick Start Update'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/17621535459276402309</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>19</thr:total></entry></feed>