<div dir="ltr"><a href="https://issues.jboss.org/browse/AGPUSH-135">https://issues.jboss.org/browse/AGPUSH-135</a><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 11, 2013 at 7:37 AM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Do we have a JIRA for the &quot;fluent API&quot; refactorings ? </div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 9, 2013 at 10:46 AM, 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"><div dir="ltr">Sure ! <div>Thanks for the updates I will for sure add this to the builder API</div></div><div>
<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 9, 2013 at 10:17 AM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Besides &quot;alias&quot;, it is also possible to &quot;filter&quot; based on &quot;deviceType&quot;.<div>


<br></div><div>For the fluent API, I think something like &quot;.deviceTypes(varargs)&quot; is needed as well</div><span><font color="#888888">
<div><br></div><div>-Matthias<br><div><br></div><div><br></div></div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 4:34 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Tue, Jul 2, 2013 at 3:13 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Folks,<div>As you know we have a Java Sender Library that can be used by any backend application that want to send messages to the Unified Message Push Server (<a href="https://github.com/aerogear/aerogear-unified-push-java-client" target="_blank">https://github.com/aerogear/aerogear-unified-push-java-client</a>).</div>





<div>The format is quite open and flexible as Matthias described it here : <a href="https://gist.github.com/matzew/b21c1404cc093825f0fb" target="_blank">https://gist.github.com/matzew/b21c1404cc093825f0fb</a></div></div>




</blockquote><div><br></div><div><br></div></div><div>the real doc is located here:</div><div><a href="http://staging.aerogear.org/docs/specs/aerogear-push-messages/" target="_blank">http://staging.aerogear.org/docs/specs/aerogear-push-messages/</a><br>




</div><div><div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">



<div><br></div>
<div>We can divide the creation of a message in 2 main parts :</div>
<div><br></div><div>- The  &quot;signalling&quot; part : list of client identifiers / specific devices etc ...</div><div>- The &quot;core&quot; message containing actually the information we want to push</div>
<div><br></div><div>Both are passed as Map and are finally converted into JSON. </div><div>Here an example of how a &quot;core&quot; message is build :</div><div><br></div><div><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px;margin-top:0px!important">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Map categories = new HashMap();
categories.put(&quot;lead&quot;, &quot;version=&quot;+leadVersion++); 
Map json = new HashMap();
json.put(&quot;id&quot;, lead.getId());
json.put(&quot;messageType&quot;, &quot;pushed_lead&quot;);
json.put(&quot;name&quot;, lead.getName());
json.put(&quot;location&quot;, lead.getLocation());
json.put(&quot;phone&quot;, lead.getPhoneNumber());
json.put(&quot;simple-push&quot;, categories);
json.put(&quot;sound&quot; ,&quot;default&quot;);
json.put(&quot;alert&quot; ,&quot;A new lead has been created&quot;);</code></pre></div><div><br></div><div>Even the format is open, we could &quot;assist&quot; a bit the developer in building the message. For that we have different options : </div>





<div>- Propose a simple Message object containing the message &quot;API&quot; :</div><div><br></div><div><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Message message = new Message();
message.setClientIdentifiers(&quot;jake&quot;,&quot;maria&quot;);
message.enableSound();//by default use &quot;default&quot; or we could do message.enableSound(&quot;boing&quot;)
message.setAlert(&quot;Watch out!);
message.setAttribute(&quot;customAttribute&quot;,&quot;yo&quot;); // custom simple strings
message.setAttribute(&quot;customStructure&quot;,myObject); // passing objects</code></pre></div><div><br></div><div>- Propose a Message Builder (following the Builder Pattern) to propose a more fluent API : </div>
<div><br></div><div><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Message message = new Message().builder()
  .clientIdentifiers(&quot;jake&quot;,&quot;maria&quot;)
  .enableSound()
  .alert(&quot;AAAAHHH!&quot;)
  .attribute(&quot;customAttribute&quot;,&quot;yo&quot;)
  .attribute(&quot;customStructure&quot;,myObject)
  .build()</code></pre></div><div><br></div></div></blockquote><div><br></div><div><br></div></div></div><div>I like the builder!  +1</div><div><div><br></div><div><br></div><div><br></div><div><br></div><div>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div></div><div>- Same as above but more DSL focused (not sure about this one ;) )</div><div><pre style="background-color:rgb(248,248,248);border-top-left-radius:3px;margin-bottom:15px;padding:6px 10px;line-height:19px;border-top-right-radius:3px;font-size:13px;overflow:auto;border-bottom-right-radius:3px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Message message = MessageDSL.to(<span style="background-color:transparent">&quot;jake&quot;,&quot;maria&quot;).withSound() //etc ...</span><br>





<br></code></pre></div><div><br></div></div></blockquote><div><br></div></div><div>+0.5 </div><div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




<div dir="ltr"><div></div><div>So, beside that we have to discuss what we want allow to pass to the message API : only Strings and simple Maps ? Full Objects that will be JSONified ? </div><div>
<br></div><div>Do we want also to separate the &quot;signalling&quot; part from the &quot;core&quot; part when building a message ? </div></div></blockquote><div><br></div></div><div>I think that would be good, without too much thinking about it.</div>




<div><br></div><div>* MessageBuilder -&gt; builds message</div><div>* &quot;signalling&quot; part, on it&#39;s own (Filter + FilterBuilder (LOL))</div><div><br></div><div>and both parts are combined into the actual &quot;payload&quot; object, to be send out.</div>




<div><br></div><div>However.... that can make the bits unnecessary complicated.... </div><div>After writing the above lines, why not starting with a Message/MessageBuilder. If separation is needed later, we can always do it later.</div>




<div><br></div><div>Greetings,</div><div>Matthias</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<div>
<div dir="ltr"><div><br></div><div>Inputs and comments more than welcome !</div>
<div><br></div><div>Seb</div><div><br></div></div>
<br></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><span><font color="#888888"><br></font></span></blockquote></div><span><font color="#888888"><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>
</font></span></div></div>
</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>
</div>
</div></div><br>_______________________________________________<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>
</div></div><br>_______________________________________________<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><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>
</div>
</div></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></div>