|
|
|
|||||
|
Dispatching legacy C++ messages via Ice
I have a legacy C++ single threaded application that receives messages over sockets and deserialises each message payload into its corresponding C++ class object. The class objects are then dispatched to various modules within the program.
I now want to modify the program to be either multithreaded or multi-process. If I go multi-process I need a mechanism to dispatch messages to each process. If I use Ice I could replicate all the message definitions as Ice (there are quite a lot of messages), or can I simply send the existing message object as a blob of bytes and let the receiving end typecast the blob back to the message? What Ice mechanism could I use to exchange message blobs? Are there issues with sending classes over the wire as blobs? Regards John |
|
||||||
|
Hi John,
You can just use a sequence of bytes "in" param to transmit your serialized data: Code:
// Slice
sequence<byte> ByteSeq;
interface MyIntf
{
void op1(ByteSeq param);
};
Note that Ice for Java and C# provide a Slice serialize metadata which allows to pass Java/C# native types directly to the Slice generated code (proxies/servants). The generated code, under the hood, takes care of the serialization to or from the byte sequence. This is possible because Java and C# both provide standard APIs for serialization. In C++, this is currently not possible, mostly because there are no standard serialization APIs (but this is something which could be added). So if you have a large number of classes and want to reduce the boiler plate code to serialize/de-serialize your classes to/from the byte sequence, an option would be to implement something similar to Java/C#. You could directly pass your native classes to the Slice generated code and have the generated code take care of the serialization/de-serialization. For an example on how this metadata could work, see the Java and C# demo/Ice/serialize in your Ice 3.4b distribution. If you are interested in sponsoring such a feature, please contact us at info@zeroc.com Cheers, Benoit. |
|
|||||
|
Is the serialization metadata for Java new in 3.4b? I've never noticed it before ... very cool.
![]() MEF
__________________
Mary Ellen Foster |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ObjectFactory for connecting to legacy classes? | moli | Help Center | 1 | 01-17-2010 06:07 PM |
| Linking ICE/C++ to a legacy C program | pjtait | Help Center | 1 | 04-23-2009 09:07 AM |
| ICE user exception messages | chris | Help Center | 1 | 01-31-2005 07:31 AM |
| Exception messages | panic | Comments | 0 | 10-19-2004 04:33 AM |
| ServantLocator and dispatching thread | ganzuoni | Help Center | 8 | 07-10-2003 12:38 PM |