<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 30, 2017 at 1:51 PM, Galder Zamarreño <span dir="ltr">&lt;<a href="mailto:galder@redhat.com" target="_blank">galder@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
For a demo I&#39;m giving next week, I&#39;d like to show how to use distributed streams via a remote server task. All server tasks that we have in testsuite rely on primitives but in my case I wanted to use POJOs.<br>
<br>
To do that, I needed to get compatibility mode working in such way that those POJOs could be unmarshalled for the server task. Since in another demo I&#39;m showing Protostream based POJOs, I thought I&#39;d try to use that as mechanism to unmarshall POJOs server side.<br>
<br>
We have a test for such scenario [1], but the reality (running on a proper server) is anything that simple. Here&#39;s a list of things I&#39;ve found out while creating a WordCount example that relies on a POJO:<br>
<br>
1. Out of the box, it&#39;s impossible to set compatibility marshaller to org.infinispan.query.remote.<wbr>CompatibilityProtoStreamMarsha<wbr>ller [1] because &quot;org.infinispan.main&quot; classloader can&#39;t access that class. I worked around that by tweaking the module.xml to have an optional dependency to &quot;org.infinispan.remote-query.<wbr>server&quot; module.<br>
<br>
2. After doing that, I had to register the protofile and associated classes remotely in the server. Again, there&#39;s no out of the box mechanism for that, so I created a remote server task that would do that [3].<br></blockquote><div><br><br></div><div>AFAICT, you should be able to do that doing a PUT in the Protobuf_Metadata cache, which entails having auth enabled. This cache should be REPL_SYNC, so no need to run a server task.<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
3. Finally, with all that in place, I was able to complete the WordCount test [4] with a final caveat: the return of the word count, and words protofile registration, tasks return objects that are not marshalled by the compatibility marshaller, so I had to make sure that the remote cache manager used for those tasks uses the default marshaller.<br>
<br>
Clearly we need to improve on this, and we have plans to address these issues (with new upcoming transcoding capabilities), but I thought it&#39;d be worth mentioning the problems found in case anyone else encounters them before transcoding is in place.<br>
<br>
Cheers,<br>
<br>
[1] <a href="https://github.com/galderz/datagrid-patterns/blob/master/server-config/domain/domain.xml#L139" rel="noreferrer" target="_blank">https://github.com/galderz/<wbr>datagrid-patterns/blob/master/<wbr>server-config/domain/domain.<wbr>xml#L139</a><br>
[2] <a href="https://github.com/galderz/datagrid-patterns/blob/master/server-config/org.infinispan.main_module.xml#L18" rel="noreferrer" target="_blank">https://github.com/galderz/<wbr>datagrid-patterns/blob/master/<wbr>server-config/org.infinispan.<wbr>main_module.xml#L18</a><br>
[3] <a href="https://github.com/galderz/datagrid-patterns/blob/master/analytics-stream/tasks-server/src/main/java/test/WordsProtoTask.java" rel="noreferrer" target="_blank">https://github.com/galderz/<wbr>datagrid-patterns/blob/master/<wbr>analytics-stream/tasks-server/<wbr>src/main/java/test/<wbr>WordsProtoTask.java</a><br>
[4] <a href="https://github.com/galderz/datagrid-patterns/blob/master/analytics-stream/tasks-client/src/test/java/test/WordCountTest.java" rel="noreferrer" target="_blank">https://github.com/galderz/<wbr>datagrid-patterns/blob/master/<wbr>analytics-stream/tasks-client/<wbr>src/test/java/test/<wbr>WordCountTest.java</a><br>
--<br>
Galder Zamarreño<br>
Infinispan, Red Hat<br>
<br>
<br>
______________________________<wbr>_________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/infinispan-<wbr>dev</a></blockquote></div><br></div></div>