hungphan227 commented on PR #2465:
URL: https://github.com/apache/james-project/pull/2465#issuecomment-2431755373

   > I propose creating a new `EventSerializer` implementation that accepts a 
input `Set<EventSerializer>`, such as `JmapEventSerializer`, 
`MailboxEventSerializer`, `AnyEventSerializer`... This approach will simplify 
Guice binding (using a set binder) and easy when one day we have a new 
`EventSerializer` implement.
   > 
   > The code looks like:
   > 
   > ```java
   > class EventSerializers implements EventSerializer {
   > 
   >     Set<EventSerializer> eventSerializers;
   > 
   >     @Inject
   >     public EventSerializers(Set<EventSerializer> eventSerializers) {
   >         this.eventSerializers = eventSerializers;
   >     }
   > 
   >     @Override
   >     public String toJson(Event event) {
   >         return "";
   >     }
   > 
   >     @Override
   >     public Event asEvent(String serialized) {
   >         eventSerializers.forEach(eventSerializer -> {
   >             // loop to find the correct event serializer
   >             }
   >         });
   >     }
   > }
   > ```
   > 
   > Then we can use `EventSerializers` for deserialize event at 
`CassandraEventDeadLettersDAO`
   
   I do not totally agree with this approach, but because you all think it is 
good, I would follow


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to