当前位置: 首页>>代码示例>>Java>>正文


Java CodecAggregator类代码示例

本文整理汇总了Java中org.graylog2.plugin.inputs.codecs.CodecAggregator的典型用法代码示例。如果您正苦于以下问题:Java CodecAggregator类的具体用法?Java CodecAggregator怎么用?Java CodecAggregator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CodecAggregator类属于org.graylog2.plugin.inputs.codecs包,在下文中一共展示了CodecAggregator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: channelRead0

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
    final SocketAddress remoteAddress = msg.sender();
    final CodecAggregator.Result result;
    try (Timer.Context ignored = aggregationTimer.time()) {
        result = aggregator.addChunk(msg.content(), remoteAddress);
    }
    final ByteBuf completeMessage = result.getMessage();
    if (completeMessage != null) {
        LOG.debug("Message aggregation completion, forwarding {}", completeMessage);
        ctx.fireChannelRead(completeMessage);
    } else if (result.isValid()) {
        LOG.debug("More chunks necessary to complete this message");
    } else {
        invalidChunksMeter.mark();
        LOG.debug("Message chunk was not valid and discarded.");
    }
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:19,代码来源:NetflowMessageAggregationHandler.java

示例2: parseNetflowPcapStream

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
private Collection<NetFlowV9Packet> parseNetflowPcapStream(String resourceName) throws IOException {
    final List<NetFlowV9Packet> allPackets = Lists.newArrayList();
    try (InputStream inputStream = Resources.getResource(resourceName).openStream()) {
        final Pcap pcap = Pcap.openStream(inputStream);
        pcap.loop(packet -> {
                    if (packet.hasProtocol(Protocol.UDP)) {
                        final UDPPacket udp = (UDPPacket) packet.getPacket(Protocol.UDP);
                        final InetSocketAddress source = new InetSocketAddress(udp.getSourceIP(), udp.getSourcePort());
                        final CodecAggregator.Result result = codecAggregator.addChunk(Unpooled.copiedBuffer(udp.getPayload().getArray()), source);
                        if (result.isValid() && result.getMessage() != null) {
                            final ByteBuf buffer = result.getMessage();
                            // must read the marker byte off the buffer first.
                            buffer.readByte();
                            allPackets.addAll(codec.decodeV9Packets(buffer));
                        }
                    }
                    return true;
                }
        );
    }
    return allPackets;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:23,代码来源:NetflowV9CodecAggregatorTest.java

示例3: decodePcapStream

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
private Collection<Message> decodePcapStream(String resourceName) throws IOException {

        final List<Message> allMessages = Lists.newArrayList();
        try (InputStream inputStream = Resources.getResource(resourceName).openStream()) {
            final Pcap pcap = Pcap.openStream(inputStream);
            pcap.loop(packet -> {
                        if (packet.hasProtocol(Protocol.UDP)) {
                            final UDPPacket udp = (UDPPacket) packet.getPacket(Protocol.UDP);
                            final InetSocketAddress source = new InetSocketAddress(udp.getSourceIP(), udp.getSourcePort());
                            final CodecAggregator.Result result = codecAggregator.addChunk(Unpooled.copiedBuffer(udp.getPayload().getArray()), source);
                            if (result.isValid() && result.getMessage() != null) {
                                final Collection<Message> c = codec.decodeMessages(convertToRawMessage(result, source));
                                if (c != null) {
                                    allMessages.addAll(c);
                                }
                            }
                        }
                        return true;
                    }
            );
        }
        return allMessages;
    }
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:24,代码来源:NetflowV9CodecAggregatorTest.java

示例4: convertToRawMessage

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
private RawMessage convertToRawMessage(CodecAggregator.Result result, SocketAddress remoteAddress) {
    final ByteBuf buffer = result.getMessage();
    assertThat(buffer).isNotNull();

    final byte[] payload = ByteBufUtil.getBytes(buffer);

    return new RawMessage(payload, (InetSocketAddress) remoteAddress);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:9,代码来源:NetflowV9CodecAggregatorTest.java

示例5: getAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Nullable
@Override
public CodecAggregator getAggregator() {
    return null;
}
 
开发者ID:sherzberg,项目名称:graylog-plugin-s3,代码行数:6,代码来源:S3Codec.java

示例6: setMessageAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Override
public void setMessageAggregator(CodecAggregator aggregator) {
    // Not supported.
}
 
开发者ID:sherzberg,项目名称:graylog-plugin-s3,代码行数:5,代码来源:S3Transport.java

示例7: setMessageAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Override
public void setMessageAggregator(CodecAggregator aggregator) {
}
 
开发者ID:condevtec,项目名称:graylog-plugin-nsq,代码行数:4,代码来源:NsqTransport.java

示例8: setMessageAggregatorDoesNothing

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Test
public void setMessageAggregatorDoesNothing() throws Exception {
    final CodecAggregator codecAggregator = mock(CodecAggregator.class);
    transport.setMessageAggregator(codecAggregator);
    verifyNoMoreInteractions(codecAggregator);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-internal-logs,代码行数:7,代码来源:SerializedLogEventTransportTest.java

示例9: getAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Nullable
@Override
public CodecAggregator getAggregator() {
    return netflowV9CodecAggregator;
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:6,代码来源:NetFlowCodec.java

示例10: aggregateRawPacket

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
private CodecAggregator.Result aggregateRawPacket(String resourceName) throws IOException {
    final byte[] bytes = Resources.toByteArray(Resources.getResource(resourceName));
    final ByteBuf channelBuffer = Unpooled.wrappedBuffer(bytes);
    return codecAggregator.addChunk(channelBuffer, source);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:6,代码来源:NetflowV9CodecAggregatorTest.java

示例11: decodeResult

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
private Collection<Message> decodeResult(CodecAggregator.Result result) {
    if (result.getMessage() == null) {
        return Collections.emptyList();
    }
    return codec.decodeMessages(convertToRawMessage(result, source));
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:7,代码来源:NetflowV9CodecAggregatorTest.java

示例12: setMessageAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Override
public void setMessageAggregator(CodecAggregator codecAggregator) {
    // nope
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-spaceweather,代码行数:5,代码来源:SpaceweatherTransport.java

示例13: setMessageAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Override
public void setMessageAggregator(CodecAggregator codecAggregator) {
    // Not supported.
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-mongodb-profiler,代码行数:5,代码来源:MongoDBProfilerTransport.java

示例14: setMessageAggregator

import org.graylog2.plugin.inputs.codecs.CodecAggregator; //导入依赖的package包/类
@Override
public void setMessageAggregator(CodecAggregator codecAggregator) {

}
 
开发者ID:sivasamyk,项目名称:graylog-plugin-input-jmx,代码行数:5,代码来源:JMXTransport.java


注:本文中的org.graylog2.plugin.inputs.codecs.CodecAggregator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。