use of fish.payara.micro.event.PayaraClusteredCDIEvent in project Payara by payara.
the class ClusteredCDIEventBusImpl method onOutboundEvent.
void onOutboundEvent(@Observes @Outbound Serializable event, EventMetadata meta) throws IOException {
PayaraClusteredCDIEvent clusteredEvent;
// read the metadata on the Outbound Annotation to set data into the event
boolean loopBack = false;
String eventName = "";
String[] instanceName = new String[0];
for (Annotation annotation : meta.getQualifiers()) {
if (annotation instanceof Outbound) {
Outbound outboundattn = (Outbound) annotation;
eventName = outboundattn.eventName();
loopBack = outboundattn.loopBack();
instanceName = outboundattn.instanceName();
}
}
clusteredEvent = new PayaraClusteredCDIEventImpl(runtime.getLocalDescriptor(), event);
clusteredEvent.setLoopBack(loopBack);
clusteredEvent.setProperty(EVENT_PROPERTY, eventName);
clusteredEvent.setProperty(INSTANCE_PROPERTY, serializeArray(instanceName));
Set<Annotation> qualifiers = meta.getQualifiers();
if (qualifiers != null && !qualifiers.isEmpty()) {
clusteredEvent.addQualifiers(qualifiers);
}
runtime.publishCDIEvent(clusteredEvent);
}
Aggregations