Search in sources :

Example 1 with Dispatcher

use of org.collectd.protocol.Dispatcher in project metrics by dropwizard.

the class Receiver method before.

@Override
protected void before() throws Throwable {
    receiver = new UdpReceiver(new Dispatcher() {

        @Override
        public void dispatch(ValueList values) {
            queue.offer(new ValueList(values));
        }

        @Override
        public void dispatch(Notification notification) {
            throw new UnsupportedOperationException();
        }
    });
    receiver.setPort(port);
    new Thread(() -> {
        try {
            receiver.listen();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }).start();
}
Also used : ValueList(org.collectd.api.ValueList) UdpReceiver(org.collectd.protocol.UdpReceiver) Dispatcher(org.collectd.protocol.Dispatcher) Notification(org.collectd.api.Notification)

Aggregations

Notification (org.collectd.api.Notification)1 ValueList (org.collectd.api.ValueList)1 Dispatcher (org.collectd.protocol.Dispatcher)1 UdpReceiver (org.collectd.protocol.UdpReceiver)1