[
https://issues.jboss.org/browse/ISPN-7711?page=com.atlassian.jira.plugin....
]
Adrian Nistor commented on ISPN-7711:
-------------------------------------
The issue of server-side protobuf schema and marshaller deployment was recently resolved
by Gustavo while working on ISPN-9181 ISPN-9184. The solution is covered in the user guide
here :
https://github.com/infinispan/infinispan/pull/6045/files#diff-5d6e8f3e7a6...
The solution was even simpler than what I described in an earlier comment as it does no
longer need a DeploymentUnitProcessor, just a simple jar deployed in the server,
containing implementations of ProtostreamSerializationContextInitializer that use the
ServiceLoader mechanism (see
https://github.com/infinispan/infinispan/blob/14afdf555b826d78622a534e50f...).
This simplification was possible due to ISPN-7714.
Remote server tasks were not seen fit for this purpose because they can only execute after
the cache is fully started, which is too late. We need these marshallers available
earlier, somewhere between cache manager startup and before cache startup. These
marshallers and the related proto schemas need to be deployed before the indexing system
of the cache starts or else the newly started cache cannot process/index the data that it
will immediately start to receive via state transfer from other cluster members.
Improve server-side protostream marshaller registration
-------------------------------------------------------
Key: ISPN-7711
URL:
https://issues.jboss.org/browse/ISPN-7711
Project: Infinispan
Issue Type: Enhancement
Reporter: Galder ZamarreƱo
Assignee: Adrian Nistor
Fix For: 9.4.0.Final
A more user friendly way to register protostream marshallers remotely is needed when the
protostream marshaller is used for compatibility mode (or transcoding) in the future.
It's currently possible to do it with a remote server task but that's a bit
hacky.
This server task shows how it can be done:
{code}
package delays.java.stream;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.query.remote.ProtobufMetadataManager;
import org.infinispan.tasks.ServerTask;
import org.infinispan.tasks.TaskContext;
import org.infinispan.tasks.TaskExecutionMode;
import delays.java.stream.pojos.Station;
import delays.java.stream.pojos.Stop;
import delays.java.stream.pojos.Train;
public class AddProtobufTask implements ServerTask {
private TaskContext ctx;
@Override
public void setTaskContext(TaskContext ctx) {
this.ctx = ctx;
}
@Override
public String getName() {
return "add-protobuf";
}
@Override
public Object call() throws Exception {
EmbeddedCacheManager cm = ctx.getCache().get().getCacheManager();
ProtobufMetadataManager protobufMetadataManager =
cm.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
protobufMetadataManager.registerMarshaller(new Stop.Marshaller());
protobufMetadataManager.registerMarshaller(new Station.Marshaller());
protobufMetadataManager.registerMarshaller(new Train.Marshaller());
return null;
}
@Override
public TaskExecutionMode getExecutionMode() {
// Registering marshallers should be done in all nodes
return TaskExecutionMode.ALL_NODES;
}
}
{code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)