{"id":20,"date":"2013-10-21T15:34:28","date_gmt":"2013-10-21T15:34:28","guid":{"rendered":"https:\/\/brianroach.info\/blog\/?p=20"},"modified":"2013-10-21T16:37:00","modified_gmt":"2013-10-21T16:37:00","slug":"building-a-better-mousetrap-client-development-with-netty-4","status":"publish","type":"post","link":"https:\/\/brianroach.info\/blog\/?p=20","title":{"rendered":"Building a better mousetrap; client development with Netty 4."},"content":{"rendered":"<p>Many developers these days don&#8217;t have to write a client library\/driver from scratch or ever have to <a href=\"http:\/\/www.youtube.com\/watch?v=jytJXjI0oQU\">Just Open A Socket<\/a>. Normally, they&#8217;re going to use an HTTP client or a driver\/library provided by the database\/whatever. I happen to be the exception; my job at the moment revolves entirely around creating those drivers for Riak.<\/p>\n<p>I&#8217;m probably the Worst Java Guy Evar in that &#8230; I&#8217;m not a Java guy. At least, not what you think of when you hear &#8220;Java guy&#8221;. I&#8217;m a polyglot forged with C who happened to have fallen into doing some Java dev once and then at Basho became &#8230; the Java guy. \u00a0In short, I&#8217;m not a big fan of including a giant framework in a project to do some stupid simple task. Or shoehorning problems into design patterns because &#8230; reasons. I also have a tendency to want to hit something every time I hear the word &#8220;Spring&#8221;.<\/p>\n<p>That said, when designing the new <a href=\"https:\/\/github.com\/basho\/riak-java-client\">Java client for Riak<\/a>, rather than writing the networky bits myself I thought maybe I&#8217;d take a look at <a href=\"http:\/\/netty.io\/\">Netty<\/a>. I&#8217;d heard good things about it and thought maybe it&#8217;d be a good fit if wasn&#8217;t overly cumbersome. We (Basho) also had some customer interest in providing async query functionality in the client which I knew Netty could provide. \u00a0In addition &#8230; lets face it, there&#8217;s nothing enjoyable about writing socket code for the umpteenth time.<\/p>\n<p>After playing with the Netty 4 for a bit I decided on using it for the new Riak client. Not only did it provide what we needed, I found <a href=\"https:\/\/twitter.com\/normanmaurer\">Norman Maurer<\/a>\u00a0at Redhat to be incredibly helpful and a real advocate for what they were developing.<\/p>\n<p>The internals of the new Riak Java client effectively will model a Riak cluster, providing load balancing and fail-over support. It also allows for both synchronous and asynchronous operations. The higher level client API will submit tasks to it and receive the replies.<\/p>\n<p><a href=\"https:\/\/brianroach.info\/blog\/wp-content\/uploads\/2013\/10\/RJC2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-24 aligncenter\" alt=\"RJC2\" src=\"https:\/\/brianroach.info\/blog\/wp-content\/uploads\/2013\/10\/RJC2.png\" width=\"303\" height=\"573\" srcset=\"https:\/\/brianroach.info\/blog\/wp-content\/uploads\/2013\/10\/RJC2.png 303w, https:\/\/brianroach.info\/blog\/wp-content\/uploads\/2013\/10\/RJC2-158x300.png 158w\" sizes=\"auto, (max-width: 303px) 100vw, 303px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Over the next couple weeks I&#8217;ll be posting a series of articles talking about how to use Netty to build a network client library. First one coming soon.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many developers these days don&#8217;t have to write a client library\/driver from scratch or ever have to Just Open A Socket. Normally, they&#8217;re going to use an HTTP client or a driver\/library provided by the database\/whatever. I happen to be the exception; my job at the moment revolves entirely around creating those drivers for Riak. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,5],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-java","category-netty","category-riak"],"_links":{"self":[{"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20"}],"version-history":[{"count":7,"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":26,"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/20\/revisions\/26"}],"wp:attachment":[{"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brianroach.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}