Search in sources :

Example 1 with UdpReceiver

use of org.collectd.protocol.UdpReceiver 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)

Example 2 with UdpReceiver

use of org.collectd.protocol.UdpReceiver in project jcollectd by collectd.

the class MBeanSenderTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    _receiverTest = new ReceiverTest();
    _receiverTest.setUp();
    UdpReceiver receiver = _receiverTest.getReceiver();
    receiver.setDispatcher(this);
    int port = receiver.getSocket().getLocalPort();
    _sender = new MBeanSender();
    _sender.addDestination("udp://localhost:" + port);
}
Also used : UdpReceiver(org.collectd.protocol.UdpReceiver) ReceiverTest(org.collectd.protocol.ReceiverTest)

Aggregations

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