[infinispan-dev] Executing server tasks that contain POJOs
rareddy at redhat.com
Thu Mar 30 10:30:16 EDT 2017
FWIW, I am rewriting Teiid translator to Infinispan, where I needed a portable marshaller that is simply based on .proto file as you describe issues with your step #2. The use of predefined custom java marshaller is not viable in my usecase, as I want to dynamically convert Relational Tables defined in the Teiid into POJO's in Infinispan, and ability to query them. I have written a such marshaller for my usecase you can see testcase at . Basically I capture the metadata from .proto file and use that information in encoding/decoding the protostream, *most* of the needed code is already there in the ProtoStream libraries.
BTW, with your Task example you gave me another idea how I can even further enhance the this integration layer in terms of updating multiple POJOs in single call :)
----- Original Message -----
> Hi all,
> For a demo I'm giving next week, I'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.
> 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'm
> showing Protostream based POJOs, I thought I'd try to use that as mechanism
> to unmarshall POJOs server side.
> We have a test for such scenario , but the reality (running on a proper
> server) is anything that simple. Here's a list of things I've found out
> while creating a WordCount example that relies on a POJO:
> 1. Out of the box, it's impossible to set compatibility marshaller to
> org.infinispan.query.remote.CompatibilityProtoStreamMarshaller  because
> "org.infinispan.main" classloader can't access that class. I worked around
> that by tweaking the module.xml to have an optional dependency to
> "org.infinispan.remote-query.server" module.
> 2. After doing that, I had to register the protofile and associated classes
> remotely in the server. Again, there's no out of the box mechanism for that,
> so I created a remote server task that would do that .
> 3. Finally, with all that in place, I was able to complete the WordCount test
>  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.
> Clearly we need to improve on this, and we have plans to address these issues
> (with new upcoming transcoding capabilities), but I thought it'd be worth
> mentioning the problems found in case anyone else encounters them before
> transcoding is in place.
> Galder Zamarreño
> Infinispan, Red Hat
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
More information about the infinispan-dev