Examples of RawMessage


Examples of org.graylog2.plugin.journal.RawMessage

        generatorService = new AbstractExecutionThreadService() {
            @Override
            protected void run() throws Exception {
                while (isRunning()) {

                    final RawMessage rawMessage = GeneratorTransport.this.produceRawMessage(input);
                    if (rawMessage != null) {
                        input.processRawMessage(rawMessage);
                    }
                }
            }
View Full Code Here

Examples of org.graylog2.plugin.journal.RawMessage

                        final byte[] bytes = message.message();
                        totalBytesRead.addAndGet(bytes.length);
                        lastSecBytesReadTmp.addAndGet(bytes.length);

                        final RawMessage rawMessage = new RawMessage("radio-msgpack",
                                input.getId(),
                                null,
                                bytes);

                        // the loop below is like this because we cannot "unsee" the message we've just gotten by calling .next()
                        // the high level consumer of Kafka marks the message as "processed" immediately after being returned from next.
                        // thus we need to retry processing it.
                        boolean retry = false;
                        int retryCount = 0;
                        do {
                            try {
                                if (retry) {
                                    // don't try immediately if the buffer was full, try not spin too much
                                    LOG.debug("Waiting 10ms to retry inserting into buffer, retried {} times",
                                            retryCount);
                                    Uninterruptibles.sleepUninterruptibly(10,
                                            TimeUnit.MILLISECONDS); // TODO magic number
                                }
                                // try to process the message, if it succeeds, we immediately move on to the next message (retry will be false)
                                // if parsing the message failed, this will return 'true' (sorry for the stupid return value handling, amqp needs to know
                                // whether to ack or nack the message)
                                final boolean discardMalformedMessage = input.processRawMessageFailFast(rawMessage);
                                if (discardMalformedMessage) {
                                    LOG.debug("Message {} was malformed, skipping message.", rawMessage.getId());
                                }
                                retry = false;
                            } catch (BufferOutOfCapacityException e) {
                                LOG.debug("Input buffer full, retrying Kafka message processing");
                                retry = true;
View Full Code Here

Examples of org.graylog2.plugin.journal.RawMessage

                final Map<String, Object> data = Maps.newHashMap();
                data.put("short_message", shortMessage);
                data.put("host", source);
                data.putAll(fields);
                final byte[] payload = mapper.writeValueAsBytes(data);
                input.processRawMessage(new RawMessage("gelf", input.getId(), null, payload));
            } catch (JsonProcessingException e) {
                log.error("Unable to serialized metrics", e);
            }
        }
View Full Code Here

Examples of org.graylog2.plugin.journal.RawMessage

                    if (r.getStatusCode() != 200) {
                        throw new RuntimeException("Expected HTTP status code 200, got " + r.getStatusCode());
                    }

                    input.processRawMessage(new RawMessage(input.getCodec().getName(),
                                                           input.getId(),
                                                           remoteAddress,
                                                           r.getResponseBody().getBytes(StandardCharsets.UTF_8)));
                } catch (InterruptedException | ExecutionException | IOException e) {
                    LOG.error("Could not fetch HTTP resource at " + url, e);
View Full Code Here

Examples of org.graylog2.plugin.journal.RawMessage

        final byte[] payload;
        try {
            final FakeHttpRawMessageGenerator.GeneratorState state = generator.generateState();
            payload = objectMapper.writeValueAsBytes(state);

            final RawMessage raw = new RawMessage("randomhttp", input.getId(), null, payload);

            sleepUninterruptibly(rateDeviation(sleepMs, maxSleepDeviation, rand), MILLISECONDS);
            return raw;
        } catch (JsonProcessingException e) {
            log.error("Unable to serialize generator state", e);
View Full Code Here

Examples of org.graylog2.plugin.journal.RawMessage

                    long deliveryTag = envelope.getDeliveryTag();
                    try {
                        totalBytesRead.addAndGet(body.length);
                        lastSecBytesReadTmp.addAndGet(body.length);

                        final RawMessage rawMessage = new RawMessage("radio-msgpack", sourceInput.getId(), null, body);
                        sourceInput.processRawMessageFailFast(rawMessage);
                        channel.basicAck(deliveryTag, false);
                    } catch (BufferOutOfCapacityException e) {
                        LOG.debug("Input buffer full, requeuing message. Delaying 10 ms until trying next message.");
                        if (channel.isOpen()) {
View Full Code Here

Examples of org.graylog2.plugin.journal.RawMessage

        assertEquals(message.getField("facility"), "syslogd");
        assertEquals(message.getField("full_message"), UNSTRUCTURED);
    }

    private RawMessage buildRawMessage(String message) {
        return new RawMessage("syslog", "input-id", new InetSocketAddress(5140), message.getBytes());
    }
View Full Code Here

Examples of org.gudy.azureus2.plugins.network.RawMessage

    }
    else {
      plug_msg = new MessageAdapter( message )//core created
    }
   
    RawMessage raw_plug = plug_encoder.encodeMessage( plug_msg );
    return new com.aelitis.azureus.core.networkmanager.RawMessage[]{ new RawMessageAdapter( raw_plug )};
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.