AdamBien / lightfish

Payara / GlassFish Monitoring Utility
121 stars 41 forks source link

Need a WebSocket for SnapShot as JSON #31

Open dukescript opened 8 years ago

dukescript commented 8 years ago

This is a RFE.

I'm creating a Client using DukeScript. I can connect to the Socket that sends the most current Snapshot (ws://localhost:8080/lightfish/snapshots/).Unfortunately it returns XML (I need JSON).

In order to test and develop, I added a dependency on moxy 2.6, created a jaxb.conf and changed the Serializer to create JSON:

org.lightfish.business.heartbeat.control.Serializer:

@PostConstruct public void initialize(){ try { JAXBContext jaxb = JAXBContext.newInstance(Snapshot.class,Escalations.class,Escalation.class); this.marshaller = jaxb.createMarshaller(); this.marshaller.setProperty("eclipselink.media-type", "application/json"); } catch (JAXBException ex) { throw new IllegalStateException("Cannot initialize JAXB context " + ex); } }

After that I can consume the messages without problems, but obviously this change breaks other clients. For my experiments that's no problem, but it would be nice to have a WebSocket that sends Snapshots as JSON, so I can contribute my Client.

AdamBien commented 8 years ago

Hi Dukescript,

I could deliver you the snapshot without Moxy. You only need the Snapshot class as JSON?

thanks and cheers,

adam

dukescript commented 8 years ago

https://github.com/AdamBien/lightfish/pull/35