Details
-
Type:
Feature Request
-
Status: Open (View Workflow)
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: transformation
-
Labels:None
-
Forum Reference:
Description
Add a transform.proto to allow transform to/from Google Protocol Buffer messages.
Gliffy Diagrams
Issue Links
- is related to
-
SWITCHYARD-183
Add JSON transformer
-
- Closed
-
FYI, using the Protostuff library (which we already do for Serialization), you can map to/from Google Protobuf using their ProtobufIOUtil class very easily.
Or (better yet), you can just wrap our existing ProtobufProtostuffSerializer (http://goo.gl/ZJcQf) inside your Transformer. It would look like this:
import org.switchyard.internal.io.*;
Serializer ser = SerializerType.PROTOBUF_PROTOSTUFF.instance();
// using byte arrays
MyPojo mypojo = new MyPojo();
byte[] bytes = ser.serialize(mypojo, MyPojo.class);
mypojo = ser.deserialize(bytes, MyPojo.class);
// using streams
MyPojo mypojo = new MyPojo();
int bytesWritten = ser.serialize(mypojo, MyPojo.class, out); // (out is your OutputStream)
mypojo = ser.deserialize(in, MyPojo.class); // (in is your InputStream)
There are plenty of Serializers available. Checkout: http://goo.gl/uqsDM
You can also customize serialization with your own Strategy. Checkout: http://goo.gl/A5GV8
Hope this helps!