WIP
[demos/kafka/outbox] / src / main / java / de / juplo / kafka / outbox / polling / UserEvent.java
diff --git a/src/main/java/de/juplo/kafka/outbox/polling/UserEvent.java b/src/main/java/de/juplo/kafka/outbox/polling/UserEvent.java
new file mode 100644 (file)
index 0000000..15db4b7
--- /dev/null
@@ -0,0 +1,59 @@
+package de.juplo.kafka.outbox.polling;
+
+import org.springframework.context.ApplicationEvent;
+
+
+public class UserEvent extends ApplicationEvent
+{
+    public enum Type
+    {
+        CREATED(1),
+        LOGIN(2),
+        LOGOUT(3),
+        DELETED(4);
+
+        public final int num;
+
+
+        Type(int num)
+        {
+            this.num = num;
+        }
+
+
+        public static Type ofInt(int ordinal)
+        {
+            switch (ordinal)
+            {
+                case 1: return CREATED;
+                case 2: return LOGIN;
+                case 3: return LOGOUT;
+                case 4: return DELETED;
+                default:
+                    throw new RuntimeException("Unknown ordinal: " + ordinal);
+            }
+        }
+
+        public static int toInt(Type type)
+        {
+            return type.toInt();
+        }
+
+        public int toInt()
+        {
+            return this.num;
+        }
+    }
+
+
+    final Type type;
+    final String user;
+
+
+    public UserEvent(Object source, Type type, String user)
+    {
+        super(source);
+        this.type = type;
+        this.user = user;
+    }
+}