<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 ! <div>Maybe one suggestion, like the PipeManager holds Pipe objecst and the DataStore hold Store objects, maybe the Notifier could hold Channels ? </div><div><br></div><div><br></div><div><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">var myChannel = AeroGear.Notifier.addChannel(String channel);</span></font></div></pre></div></blockquote><div>
<br></div><div><br></div><div>You still want to give that &#39;channel&#39; object a &quot;notification listener:</div><div><br></div><div><span style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:16px;white-space:pre">var myChannel = AeroGear.Notifier.addChannel(</span><span style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:16px;white-space:pre">String channel, func callback);</span></div>
<div> </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"><div><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">
myChannel.onMessage(data);</span></font></div></pre></div></blockquote><div><br></div><div>that onMEssage would be only invoked by the &#39;underlying&#39; app; Or what do you mean?</div><div><br></div><div>You registered callback receives the payload/</div>
<div><br></div><div> </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">
<div><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px">
myChannel.publishMessage(data);</span></font></div></pre></div></blockquote><div><br></div><div>Usually it&#39;s nicer of the object just sets the &#39;channel&#39; - 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> </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">
<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 &quot;clients&quot; which holds channels ... </span></font></div>
</pre></div></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&#39;t do that... and we would add (I guess) un-needed API code...</div>
<div><br></div><div>-M</div><div><br></div><div> </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">
<div><font face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:16px"><br></span></font></div></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 <em>Notifier</em> 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 <em>wrap</em> messaging APIs (e.g. Stomp.js, Vertx&#39;s eventbus or Socket.io/Engine.io) behind a common client &#39;interface&#39;.</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 <em>connect</em> to a messaging system in order to <em>subscribe</em> to a channel to reveice messages from that channel. The AG-Notifier is also able to <em>publish</em> messages to ANY channel. Of course,<em>unsubscribe</em> and <em>disconnect</em> 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 <em>SPEC</em>, but it&#39;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,&#39;Liberation Mono&#39;,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 <em>STATE-MASHINE</em> 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,&#39;Liberation Mono&#39;,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>


<p 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: <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,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>...</p>


<p 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></p><p 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></p><p 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 ?</p><span><font color="#888888"><p 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></p><p 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></p><p 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></p><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>