data-prepper icon indicating copy to clipboard operation
data-prepper copied to clipboard

Add a Dedicated class for transformation between Event and WireEvent

Open asifsmohammed opened this issue 2 years ago • 0 comments

Have a class which is dedicated to the transformation between WireEvent and Event both directions. The client and server would use this class. It could even have two interfaces so they are not necessarily coupled.

Here is an outline of it:

The server would use:

interface WireEventDeserializer {
  Event deserializeEvent(WireEvent wireEvent)

The client would use:

interface WireEventSerializer {
  WireEvent serializeEvent(Event event)

Then you can have one class which implements both:

class WireEventTransformer implements WireEventSerializer, WireEventDeserializer

All the logic for this transformation is in one place.

Originally posted by @dlvenable in https://github.com/opensearch-project/data-prepper/pull/1705#discussion_r960057128

asifsmohammed avatar Sep 01 '22 16:09 asifsmohammed