This content has been marked as final.
Show 2 replies
-
1. Re: How to register a custom marshalling strategy?
swiderski.maciej Apr 15, 2014 11:56 AM (in response to jocelyn.duc)1 of 1 people found this helpfulunfortunately there is no easy way to register custom marshaling strategies in console at the moment, in 6.1 it should be made possible via deployment descriptors. For now you should abuse the use of CDI based work item handler producers to grab a session from argument and simply add your strategy into the ksession environment. See docs about WorkItemHandlerProducer (section 5.4.4.2.1) that will be then invoked for every ksession loaded/created.
HTH
-
2. Re: Re: How to register a custom marshalling strategy?
jocelyn.duc Apr 29, 2014 6:09 AM (in response to swiderski.maciej)Hello,
Here is the workaround I have done to register my custom marshalling strategy to the jbpm-console (6.0.1). It seems to work! But I am not sure if it is necessary to register again the default Serializable strategy
public class EncapsulatedDataWorkItemHandler implements WorkItemHandler { public EncapsulatedDataWorkItemHandler(KieSession ksession) { ObjectMarshallingStrategy[] oms = { new EncapsulatedDataPlaceholderResolverStrategy(EncapsulatedDataObjectMarshallingStrategyAcceptor.DEFAULT), new SerializablePlaceholderResolverStrategy(ClassObjectMarshallingStrategyAcceptor.DEFAULT) }; Environment env = ksession.getEnvironment(); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, oms); } ... }
CustomWorkItemHandlers.conf:
[ "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(), "WebService": new org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler(ksession), "Rest": new org.jbpm.process.workitem.rest.RESTWorkItemHandler(), "Service Task" : new org.jbpm.process.workitem.bpmn2.ServiceTaskHandler(ksession), "Encapsulated Data" : new my.package.EncapsulatedDataWorkItemHandler(ksession) ]
HTH