object oriented design – Enum and Programming to Interface and best practices

I am learning stuff and have made 2 microservices, Listener and App.
Listener is a jsm consumer and App is the app talking to the jms.

I want to have 2 type of events but want to maintain a single queue.
So, my Event class looks something like this

public class Event{
   private String type;
   private EventPayload payload;

Now I want to make EventPayload a marker interface which will be implemented by 2 classes

public class CreateEvent implements EventPayload {
    private DomainObjectA a;
    private DomainObjectB b;
    private DomainObjectC c;
    private DomainObjectD d;

public class UpdateEvent implements EventPayload {      
        private DomainObjectC c;

Now depending on the type of event(create or update) in my App project, I want to use the corresponding EventPayload type to set data i.e. if event type is create i want to build CreateEvent object while when event type is update i want to build UpdateEvent object.

I thought of defining an Enum as show below:

public enum EventEnum {
    CREATE("CREATE", new CreateEvent()), UPDATE("UPDATE", new UpdateEvent());
    private final String type;
    private final EventPayload payload; //interface for the event types
    private EventEnum(String type, EventPayload payload) {
        this.type = type;
        this.payload = payload;

    public String getType() {
        return type;

    public EventPayload getPayload() {
        return payload;

I want to use this enum for type-safety in my App project.

So for create event in my App project, I want something like

 //trying to program to interface here so that I can handle diff type of payloads for same property
 EventPayload payload = EventEnum.CREATE.getPayload();

For update event in my App project, I want something like

 EventPayload payload = EventEnum.UPDATE.getPayload();

In my Listener project I want to check the type of event and based on whether its CREATE or UPDATE
I want to do something like below:

    @JmsListener(destination = "event-queue", containerFactory = "myFactory")
    public void receiveMessage(AlertEvent alertEvent) {

public void save(AlertEvent alertEvent){
        String event = alertEvent.getType();
        EventPayload payload = alertEvent.getPayload();
        if(null == event || null == payload){
            LOGGER.error("Either Event or Payload is null");

private void insert(CreateEvent payload){

private void update(UpdateEvent payload){

I have 2 questions:

  1. Is my design i.e. using enum in this way a naive idea and not a good one. If not what will be a good way to handle things in this scenario.

  2. Programming to interfcae idea backfired as I realized I am not using it in the right way. Please can you guide me as to where am I making mistake.

Please go easy on me as I am learning things and just beginning to think about proper design. Thank you.