Search in sources :

Example 1 with ProtobufMarshallerWriteContext

use of org.drools.serialization.protobuf.ProtobufMarshallerWriteContext in project drools by kiegroup.

the class WorkItemInfo method transform.

// @PreUpdate
@Override
public void transform() {
    this.state = workItem.getState();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        MarshallerWriteContext context = new ProtobufMarshallerWriteContext(baos, null, null, null, null, this.env);
        ProtobufOutputMarshaller.writeWorkItem(context, workItem);
        context.close();
        this.workItemByteArray = baos.toByteArray();
    } catch (IOException e) {
        throw new IllegalArgumentException("IOException while storing workItem " + workItem.getId() + ": " + e.getMessage());
    }
}
Also used : ProtobufMarshallerWriteContext(org.drools.serialization.protobuf.ProtobufMarshallerWriteContext) ProtobufMarshallerWriteContext(org.drools.serialization.protobuf.ProtobufMarshallerWriteContext) MarshallerWriteContext(org.drools.core.marshalling.MarshallerWriteContext) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 MarshallerWriteContext (org.drools.core.marshalling.MarshallerWriteContext)1 ProtobufMarshallerWriteContext (org.drools.serialization.protobuf.ProtobufMarshallerWriteContext)1