commandInvocation
.outbound(new RestPayloadImpl.Outbound(false))
.subject(getSubject())
.managedJob()
.parameters(params);
final EventOutput ec = new EventOutput();
AdminCommandListener listener = new AdminCommandListener() {
@Override
public void onAdminCommandEvent(String name, Object event) {
if (name == null || name.startsWith("client.")) {
return; //Prevent events from client to be send back to client
}
if (event == null) {
return;
}
if (ec.isClosed()) {
return;
}
OutboundEvent outEvent = new OutboundEvent.Builder()
.name(name)
.mediaType(MediaType.APPLICATION_JSON_TYPE)
.data(event.getClass(), event)
.build();
try {
ec.write(outEvent);
} catch (Exception ex) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, strings.getLocalString("sse.writeevent.exception",
"Can not write object as SSE (type = {0})",
event.getClass().getName()), ex);