<div dir="ltr">Besides "alias", it is also possible to "filter" based on "deviceType".<div><br></div><div>For the fluent API, I think something like ".deviceTypes(varargs)" is needed as well</div>
<div><br></div><div>-Matthias<br><div><br></div><div><br></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"><<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>></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 class="im">On Tue, Jul 2, 2013 at 3:13 PM, Sebastien Blanc <span dir="ltr"><<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.com</a>></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 class="h5"><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 "signalling" part : list of client identifiers / specific devices etc ...</div><div>- The "core" 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 "core" 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,'Liberation Mono',Courier,monospace;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px;margin-top:0px!important">
<code style="font-family:Consolas,'Liberation Mono',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("lead", "version="+leadVersion++);
Map json = new HashMap();
json.put("id", lead.getId());
json.put("messageType", "pushed_lead");
json.put("name", lead.getName());
json.put("location", lead.getLocation());
json.put("phone", lead.getPhoneNumber());
json.put("simple-push", categories);
json.put("sound" ,"default");
json.put("alert" ,"A new lead has been created");</code></pre></div><div><br></div><div>Even the format is open, we could "assist" a bit the developer in building the message. For that we have different options : </div>
<div>- Propose a simple Message object containing the message "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,'Liberation Mono',Courier,monospace;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,'Liberation Mono',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("jake","maria");
message.enableSound();//by default use "default" or we could do message.enableSound("boing")
message.setAlert("Watch out!);
message.setAttribute("customAttribute","yo"); // custom simple strings
message.setAttribute("customStructure",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,'Liberation Mono',Courier,monospace;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,'Liberation Mono',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("jake","maria")
.enableSound()
.alert("AAAAHHH!")
.attribute("customAttribute","yo")
.attribute("customStructure",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 class="im"><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,'Liberation Mono',Courier,monospace;margin-top:15px;border:1px solid rgb(221,221,221);border-bottom-left-radius:3px">
<code style="font-family:Consolas,'Liberation Mono',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">"jake","maria").withSound() //etc ...</span><br>
<br></code></pre></div><div><br></div></div></blockquote><div><br></div></div><div>+0.5 </div><div class="im"><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 "signalling" part from the "core" 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 -> builds message</div><div>* "signalling" part, on it's own (Filter + FilterBuilder (LOL))</div><div><br></div><div>and both parts are combined into the actual "payload" 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 class="im">
<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 class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><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>