Package com.netflix.suro.message

Examples of com.netflix.suro.message.DefaultMessageContainer$Item


                            pausedTime.addAndGet(-pause);
                        }
                        byte[] message = stream.next().message();
                        router.process(
                                KafkaConsumer.this,
                                new DefaultMessageContainer(new Message(topic, message), jsonMapper));
                    } catch (ConsumerTimeoutException timeoutException) {
                        // do nothing
                    } catch (Exception e) {
                        log.error("Exception on consuming kafka with topic: " + topic, e);
                    }
View Full Code Here


    private void processMessageSet(TMessageSet tMessageSet) {
        MessageSetReader reader = new MessageSetReader(tMessageSet);

        for (final Message message : reader) {
            try {
                router.process(input, new DefaultMessageContainer(message, jsonMapper));
            } catch (Exception e) {
                DynamicCounter.increment(messageProcessErrorMetrics,
                    TagKey.APP, tMessageSet.getApp(),
                    TagKey.DATA_SOURCE, message.getRoutingKey());
View Full Code Here

        try {
            Map<String, Object> blob = jsonMapper.readValue(data, S3Consumer.typeReference);
            List<Map<String, Object>> records = (List<Map<String, Object>>) blob.get("Records");
            for (Map<String, Object> record : records) {
                messages.add(new DefaultMessageContainer(
                        new Message(routingKey, jsonMapper.writeValueAsBytes(record)),
                        jsonMapper));
            }
        } catch (Exception e) {
            log.error("Exception on parsing: " + e.getMessage(), e);
View Full Code Here

    @Override
    public List<MessageContainer> parse(String data) {
        if (routingKey != null) {
            return new ImmutableList.Builder<MessageContainer>()
                    .add(new DefaultMessageContainer(
                            new Message(routingKey, data.getBytes()),
                            jsonMapper))
                    .build();
        } else {
            try {
                Map<String, Object> record = jsonMapper.readValue(data, S3Consumer.typeReference);
                String routingKeyOnRecord = record.get(routingKeyField).toString();
                if (Strings.isNullOrEmpty(routingKeyOnRecord)) {
                    routingKeyOnRecord = routingKey;
                }
                if (!Strings.isNullOrEmpty(routingKeyOnRecord)) {
                    return new ImmutableList.Builder<MessageContainer>()
                            .add(new DefaultMessageContainer(
                                    new Message(routingKeyOnRecord, data.getBytes()),
                                    jsonMapper))
                            .build();
                } else {
                    return new ArrayList<MessageContainer>();
View Full Code Here

            @Override
            public void run() {
                while (run.get()) {
                    rateLimiter.acquire();
                    try {
                        kafkaSink.writeTo(new DefaultMessageContainer(
                                new Message(
                                        topicName,
                                        jsonMapper.writeValueAsBytes(
                                                new ImmutableMap.Builder<String, Object>()
                                                        .put("f1", "v1")
View Full Code Here

      FilePersistenceTooBigForSerializationException {

    IFilePersistence filePersistence = createFilePersistence(true);
    IDataAccessSession session = filePersistence.createDataAccessSession();
    session.open();
    Item item = new Item(0, "value");
    session.setObject("key", item);
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();

    filePersistence = createFilePersistence(false);
    session = filePersistence.createDataAccessSession();
    session.open();
    item = (Item) session.getObject("key");
    assertEquals("bad state", 0, item.getIdentifier());
    assertEquals("bad state", "value", item.getValue());
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

TOP

Related Classes of com.netflix.suro.message.DefaultMessageContainer$Item

Copyright © 2018 www.massapicom. 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.