Custom Converter For Events

I have this event in service A

Event A{ Class1 i; Class2 j; String k; }

and this in service B
Event B{ String k; ClaSs2 j;// No same class but interconvertable }

I want to handle the event from service A in service B, ignoring Class1 that service B doesn’t know about. However xstream will complain. So I’m looking for a converter implementation that will just ignore the fields that it doesn’t find in service B and go on with the conversion.

Hi Harvey,

you probably want to use this:
http://x-stream.github.io/javadoc/com/thoughtworks/xstream/XStream.html#ignoreUnknownElements–

It’s an Xstream feaure.

If you’re on Spring and don’t want to mess up autoconfiguration, you can use the following:

(may contain typos, not copied from IDE)
@Autowired
public void configSerializer(XStreamSerializer serializer) {
serializer.getXStream().ignoreUnknownElements();
}

Hope this helps,
Cheers,

Allard

Thanks Allard