<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 22, 2013, at 4:04 AM, Matthias Wessendorf &lt;<a href="mailto:matzew@apache.org">matzew@apache.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">On Thu, Feb 21, 2013 at 9:00 PM, Sebastien Blanc <span dir="ltr">&lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That looks great !&nbsp;<div>Maybe one suggestion, like the PipeManager holds Pipe objecst and the DataStore hold Store objects, maybe the Notifier could hold Channels ?&nbsp;</div><div><br></div><div><br></div><div><pre style="width:744px;margin-bottom:0px;margin-top:0px;word-wrap:break-word;padding:0px"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">var myChannel = AeroGear.Notifier.addChannel(String channel);</span></font></pre></div></blockquote><div>
<br></div><div><br></div><div>You still want to give that 'channel' object a "notification listener:</div><div><br></div><div><span style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre">var myChannel = AeroGear.Notifier.addChannel(</span><span style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre">String channel, func callback);</span></div>
<div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><pre style="width:744px;margin-bottom:0px;margin-top:0px;word-wrap:break-word;padding:0px"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">
myChannel.onMessage(data);</span></font></pre></blockquote><div><br></div><div>that onMEssage would be only invoked by the 'underlying' app; Or what do you mean?</div><div><br></div><div>You registered callback receives the payload/</div>
<div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><pre style="width:744px;margin-bottom:0px;margin-top:0px;word-wrap:break-word;padding:0px"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">
myChannel.publishMessage(data);</span></font></pre></blockquote><div><br></div><div>Usually it's nicer of the object just sets the 'channel' - even JMS does allow you this:</div><div><br></div><div>
<a href="http://docs.oracle.com/cd/E17802_01/products/products/jms/javadoc-102a/javax/jms/TopicPublisher.html">http://docs.oracle.com/cd/E17802_01/products/products/jms/javadoc-102a/javax/jms/TopicPublisher.html</a></div>
<div><br></div><div>send(topic, msg);</div><div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><pre style="width:744px;margin-bottom:0px;margin-top:0px;word-wrap:break-word;padding:0px"><div><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px"><br></span></font></div>
<div><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">And maybe pushing the concept further, the notifier could hold "clients" which holds channels ... </span></font></div>
</pre></blockquote><div><br></div><div><br></div><div>Not really sure we need to build all this around it;</div><div><br></div><div><br></div><div>Most libs (that we may wrap: vertx, stomp.js) don't do that... and we would add (I guess) un-needed API code…</div></div></blockquote>The reason I would say we need this is that it would better match our other modular APIs and allow for easier creation, management and use of multiple messaging services. I'm imagining someone building a stock trading app that has a messaging system with their back end but they also want the app to subscribe to a stock ticker type messaging service. This would allow for a single point for managing those connections.<br><blockquote type="cite"><div class="gmail_quote">
<div><br></div><div>-M</div><div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><pre style="width:744px;margin-bottom:0px;margin-top:0px;word-wrap:break-word;padding:0px"><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px"><br></span></font></pre><br><div class="gmail_quote"><div><div class="h5">On Thu, Feb 21, 2013 at 6:38 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px;margin-top:0px!important">

Hello!</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">
Today, I had a brief chat with Kris about a potential AeroGear&nbsp;<em>Notifier</em>&nbsp;Client API...</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">


The basic idea is to&nbsp;<em>wrap</em>&nbsp;messaging APIs (e.g. Stomp.js, Vertx's eventbus or Socket.io/Engine.io) behind a common client 'interface'.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">


Basically the AeroGear-Notifier should be able to&nbsp;<em>connect</em>&nbsp;to a messaging system in order to&nbsp;<em>subscribe</em>&nbsp;to a channel to reveice messages from that channel. The AG-Notifier is also able to&nbsp;<em>publish</em>&nbsp;messages to ANY channel. Of course,<em>unsubscribe</em>&nbsp;and&nbsp;<em>disconnect</em>&nbsp;are required too...</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Sure... the above is not (YET) really a&nbsp;<em>SPEC</em>, but it's start.... the JS API of the AG-Notifier (DRAFT 0.0.1) could looks like this:</p>


<div style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;padding:0px;border:0px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Connects to a given URL. The callback is invoked after a connection has been established. In case of an error, an Error</span>
<span style="color:rgb(153,153,136);font-style:italic"> * object will be passed to the callback</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>connect</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>url</span><span>,</span> <span style="font-weight:bold">function</span> <span>callback</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Tears down the connection. The callback is invoked after a connection has been closed. In case of an error, an</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Error object will be passed to the callback</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>disconnect</span><span>(</span><span style="font-weight:bold">function</span> <span>callback</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Subscribes to a channel. The callback function is invoked for every message, received on the given channel.</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>subscribe</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>channel</span><span>,</span> <span style="font-weight:bold">function</span> <span>callback</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Removes the subscription of the given channel.</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>unsubscribe</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>channel</span><span>);</span>

<span style="color:rgb(153,153,136);font-style:italic">/**</span>
<span style="color:rgb(153,153,136);font-style:italic"> * Publishes a message to a given channel</span>
<span style="color:rgb(153,153,136);font-style:italic"> */</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>publish</span><span>(</span><span style="color:rgb(0,134,179)">String</span> <span>channel</span><span>,</span> <span style="color:rgb(0,134,179)">Object</span> <span>message</span><span>);</span>
</pre></div><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:13.63636302947998px;line-height:20px">Perhaps a&nbsp;<em>STATE-MASHINE</em>&nbsp;would be nice as well:</p><div style="line-height:20px;font-size:13.63636302947998px;font-family:Helvetica,arial,freesans,clean,sans-serif;padding:0px;border:0px">


<pre style="font-size:13px;line-height:19px;font-family:Consolas,'Liberation Mono',Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>CONNECTING</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">0</span><span>;</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>OPEN</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">1</span><span>;</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>CLOSING</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">2</span><span>;</span>
<span>AeroGear</span><span>.</span><span>Notifier</span><span>.</span><span>CLOSED</span> <span style="font-weight:bold">=</span> <span style="color:rgb(0,153,153)">3</span><span>;</span>
</pre></div><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);font-family:Helvetica,arial,freesans,clean,sans-serif"><a name="13cfe5851a823e8f_13cfdd5a0e71af03_implementation-of-the-adapters" href="https://gist.github.com/matzew/bd4f3c41e1114c225eb1#implementation-of-the-adapters" style="color:rgb(65,131,196);text-decoration:initial;display:block;padding-left:30px" target="_blank"></a>Implementation of the Adapters</h2><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; ">The different adapter implementations will be done separately:&nbsp;<code style="font-size:12px;line-height:normal;font-family:Consolas,'Liberation Mono',Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">ag-notifier-vertx.js</code>...</div><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; ">


<br></div><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; ">Thoughts ?</div><span><font color="#888888"><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; ">


<br></div><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13.63636302947998px; line-height: 20px; margin-bottom: 0px !important; ">


<br></div><br>-- <br>Matthias Wessendorf<br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>


twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
</font></span><br></div></div>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</blockquote></div><br></body></html>