
com.aol.micro.server.events.GenericEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micro-events Show documentation
Show all versions of micro-events Show documentation
Opinionated rest microservices
The newest version!
package com.aol.micro.server.events;
import com.google.common.eventbus.EventBus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class GenericEvent {
private GenericEventData data;
public static GenericEvent trigger(String name, EventBus bus) {
return trigger(name, bus, null, new String[]{});
}
public static GenericEvent trigger(String name, EventBus bus, String[] subTypes) {
return trigger(name, bus, null, subTypes);
}
public static GenericEvent trigger(String name, EventBus bus, T data, String[] subTypes) {
GenericEvent event = new GenericEvent<>(GenericEventData.builder()
.name(name)
.data(data)
.subTypes(subTypes)
.build());
bus.post(event);
return event;
}
@AllArgsConstructor
@Builder
@Getter
public static class GenericEventData extends BaseEventInfo {
private final String name;
private final String[] subTypes;
private final T data;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy