• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MisfireException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doLaunch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void doLaunch(MessageInput input) throws MisfireException {
    serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));

    LOG.info("Starting s3 subscriber");

    final String legacyRegionName = input.getConfiguration().getString(CK_LEGACY_AWS_REGION, DEFAULT_REGION.getName());
    final String sqsRegionName = input.getConfiguration().getString(CK_AWS_SQS_REGION, legacyRegionName);
    final String s3RegionName = input.getConfiguration().getString(CK_AWS_S3_REGION, legacyRegionName);

    subscriber = new S3Subscriber(
            Region.getRegion(Regions.fromName(sqsRegionName)),
            Region.getRegion(Regions.fromName(s3RegionName)),
            input.getConfiguration().getString(CK_SQS_NAME),
            input,
            input.getConfiguration().getString(CK_ACCESS_KEY),
            input.getConfiguration().getString(CK_SECRET_KEY),
            input.getConfiguration().getInt(CK_THREAD_COUNT)
    );

    subscriber.start();
}
 
开发者ID:sherzberg,项目名称:graylog-plugin-s3,代码行数:23,代码来源:S3Transport.java


示例2: doLaunch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
protected void doLaunch(final MessageInput input) throws MisfireException {
    consumer = new NsqClientBuilder(configuration).buildLookupd(new NSQMessageCallback() {
        @Override
        public void message(NSQMessage nsqMessage) {
            final RawMessage rawMessage = new RawMessage(nsqMessage.getMessage());
            nsqMessage.finished();
            input.processRawMessage(rawMessage);

            // do throttle the code
            if (isThrottled()) {
                blockUntilUnthrottled();
            }

        }
    });

    consumer.start();
}
 
开发者ID:condevtec,项目名称:graylog-plugin-nsq,代码行数:20,代码来源:NsqTransport.java


示例3: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
    appender = new DirectConsumingAppender(
            "graylog-plugin-internal-logs",
            logEvent -> input.processRawMessage(new RawMessage(logEvent)),
            threshold);
    addAppender(appender);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-internal-logs,代码行数:9,代码来源:SerializedLogEventTransport.java


示例4: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(final MessageInput messageInput) throws MisfireException {
    LogEventListener listener = new LogEventListener() {
        @Override
        public void onEvents(List<LogEvent> list) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                for (LogEvent event : list) {
                    ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
                    mapper.writeValue(byteStream,convertToGELF(event));
                    messageInput.processRawMessage(new RawMessage(byteStream.toByteArray()));
                    byteStream.close();
                }
            } catch (Exception e) {
                LOGGER.warn("Exception while processing event ",e);
            }
        }
    };
    ServerConfiguration serverConfiguration = new ServerConfiguration();
    serverConfiguration.setIpAddress(configuration.getString(CK_BIND_IP));
    serverConfiguration.setPort(configuration.getInt(CK_BIND_PORT));
    serverConfiguration.setKeyStorePath(configuration.getString(CK_KEYSTORE_PATH));
    serverConfiguration.setKeyStorePass(configuration.getString(CK_KEYSTORE_PASSWORD));
    serverConfiguration.setKeyPass(configuration.getString(CK_KEY_PASSWORD));
    LOGGER.info("Starting LumberjackTransport with config :" + configuration);
    lumberjackServer = new LumberjackServer(serverConfiguration,
            listener);
    lumberjackServer.start();
    LOGGER.info("Lumberjack transport started");
}
 
开发者ID:sivasamyk,项目名称:graylog2-input-lumberjack,代码行数:31,代码来源:LumberjackTransport.java


示例5: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(final MessageInput messageInput) throws MisfireException {
    EventListener listener = new EventListener() {
        @Override
        public void onEvents(List<Event> list) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                for (Event event : list) {
                    ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
                    mapper.writeValue(byteStream,convertToGELF(event));
                    messageInput.processRawMessage(new RawMessage(byteStream.toByteArray()));
                    byteStream.close();
                }
            } catch (Exception e) {
                LOGGER.warn("Exception while processing event ",e);
            }
        }
    };
    ServerConfiguration serverConfiguration = new ServerConfiguration();
    serverConfiguration.setIpAddress(configuration.getString(CK_BIND_IP));
    serverConfiguration.setPort(configuration.getInt(CK_BIND_PORT));
    serverConfiguration.setKeyStorePath(configuration.getString(CK_KEYSTORE_PATH));
    serverConfiguration.setKeyStorePass(configuration.getString(CK_KEYSTORE_PASSWORD));
    serverConfiguration.setKeyPass(configuration.getString(CK_KEY_PASSWORD));
    LOGGER.info("Starting BeatsTransport with config :" + configuration);
    lumberjackServer = new LumberjackServer(serverConfiguration,
            listener);
    lumberjackServer.start();
    LOGGER.info("BeatsTransport started");
}
 
开发者ID:sivasamyk,项目名称:graylog-beats-plugin,代码行数:31,代码来源:BeatsTransport.java


示例6: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
    ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder()
            .setDaemon(true)
            .setNameFormat("aws-kinesis-reader-%d")
            .setUncaughtExceptionHandler((t, e) -> LOG.error("Uncaught exception in AWS Kinesis reader.", e))
            .build());

    final AWSPluginConfiguration awsConfig = clusterConfigService.getOrDefault(AWSPluginConfiguration.class,
            AWSPluginConfiguration.createDefault());
    AWSAuthProvider authProvider = new AWSAuthProvider(
            awsConfig, configuration.getString(CK_ACCESS_KEY),
            configuration.getString(CK_SECRET_KEY),
            configuration.getString(CK_AWS_REGION),
            configuration.getString(CK_ASSUME_ROLE_ARN)
    );

    this.reader = new KinesisConsumer(
            configuration.getString(CK_KINESIS_STREAM_NAME),
            Region.getRegion(Regions.fromName(configuration.getString(CK_AWS_REGION))),
            kinesisCallback(input),
            awsConfig,
            authProvider,
            nodeId,
            graylogConfiguration.getHttpProxyUri() == null ? null : HttpUrl.get(graylogConfiguration.getHttpProxyUri())
    );

    LOG.info("Starting Kinesis reader thread for input [{}/{}]", input.getName(), input.getId());

    executor.submit(this.reader);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-aws,代码行数:32,代码来源:KinesisTransport.java


示例7: doLaunch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void doLaunch(MessageInput input) throws MisfireException {
    serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));

    final AWSPluginConfiguration config = clusterConfigService.getOrDefault(AWSPluginConfiguration.class,
            AWSPluginConfiguration.createDefault());

    LOG.info("Starting cloud trail subscriber");

    final String legacyRegionName = input.getConfiguration().getString(CK_LEGACY_AWS_REGION, DEFAULT_REGION.getName());
    final String sqsRegionName = input.getConfiguration().getString(CK_AWS_SQS_REGION, legacyRegionName);
    final String s3RegionName = input.getConfiguration().getString(CK_AWS_S3_REGION, legacyRegionName);

    final HttpUrl proxyUrl = config.proxyEnabled() && httpProxyUri != null ? HttpUrl.get(httpProxyUri) : null;

    final AWSAuthProvider authProvider = new AWSAuthProvider(
            config,
            input.getConfiguration().getString(CK_ACCESS_KEY),
            input.getConfiguration().getString(CK_SECRET_KEY),
            input.getConfiguration().getString(CK_AWS_SQS_REGION),
            input.getConfiguration().getString(CK_ASSUME_ROLE_ARN)
    );

    subscriber = new CloudTrailSubscriber(
            Region.getRegion(Regions.fromName(sqsRegionName)),
            Region.getRegion(Regions.fromName(s3RegionName)),
            input.getConfiguration().getString(CK_SQS_NAME),
            input,
            authProvider,
            proxyUrl,
            objectMapper
    );

    subscriber.start();
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-aws,代码行数:36,代码来源:CloudTrailTransport.java


示例8: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput messageInput) throws MisfireException {

    this.executionInterval = configuration.getInt(CK_CONFIG_INTERVAL);
    this.getExecutionIntervalTimeUnit = TimeUnit.valueOf(configuration.getString(CK_CONFIG_INTERVAL_UNIT));
    this.label = configuration.getString(CK_CONFIG_LABEL);
    String hosts[] = configuration.getString(CK_CONFIG_HOSTS).split(",");

    servers = new ArrayList<>(hosts.length);

    for (String host : hosts) {
        Server server = Server.builder().setHost(host.trim())
                .setPort(String.valueOf(configuration.getInt(CK_CONFIG_PORT)))
                .setUsername(configuration.getString(CK_CONFIG_USER_NAME))
                .setPassword(configuration.getString(CK_CONFIG_PASSWORD))
                .setTrustStorePath(configuration.getString(CK_CONFIG_TRUSTSTORE_PATH))
                .setTrustStorePass(configuration.getString(CK_CONFIG_TRUSTSTORE_PASS))
                .build();
        servers.add(server);
    }

    String jmxObjectType = configuration.getString(CK_CONFIG_TYPE);
    ObjectMapper configMapper = new ObjectMapper();
    String jsonFilePath = jmxObjectType;

    try {
        if ("custom".equals(jmxObjectType)) {
            jsonFilePath = configuration.getString(CK_CONFIG_CUSTOM_FILE_PATH);
            if (jsonFilePath != null && jsonFilePath.length() > 0) {
                if (new File(jsonFilePath).exists()) {
                    queryConfig = configMapper.readValue(new File(jsonFilePath), GLQueryConfig.class);
                } else {
                    LOGGER.error("Custom config file not present." + jsonFilePath);
                    throw new MisfireException("Cannot find custom config file " + jsonFilePath);
                }
            } else {
                LOGGER.error("Custom config file not entered.");
                throw new MisfireException("Custom config file not entered");
            }
        } else {
            queryConfig = configMapper.readValue(
                    JMXTransport.class.getClassLoader().getResourceAsStream(jsonFilePath),
                    GLQueryConfig.class);
        }
    } catch (IOException e) {
        LOGGER.error("Exception while parsing config file", e);
        throw new MisfireException("Exception while parsing config file " + jsonFilePath, e);
    }
    startMonitoring(messageInput);
}
 
开发者ID:sivasamyk,项目名称:graylog-plugin-input-jmx,代码行数:51,代码来源:JMXTransport.java


示例9: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput messageInput) throws MisfireException {
    scheduler.scheduleAtFixedRate(readDataFromNOAA(messageInput), 0, 60, TimeUnit.SECONDS);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-spaceweather,代码行数:5,代码来源:SpaceweatherTransport.java


示例10: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
    public void launch(MessageInput messageInput) throws MisfireException {
        this.messageInput = messageInput;
        URLMonitorConfig urlMonitorConfig = new URLMonitorConfig();
        urlMonitorConfig.setUrl(configuration.getString(CK_CONFIG_URL));
        urlMonitorConfig.setLabel(configuration.getString(CK_CONFIG_LABEL));
        urlMonitorConfig.setMethod(configuration.getString(CK_CONFIG_METHOD));

        String proxyUri = configuration.getString(CK_CONFIG_HTTP_PROXY);
        if (proxyUri != null && !proxyUri.isEmpty()) {
            urlMonitorConfig.setHttpProxyUri(URI.create(proxyUri));
        }

        String requestHeaders = configuration.getString(CK_CONFIG_HEADERS_TO_SEND);
        if (StringUtils.isNotEmpty(requestHeaders)) {
            urlMonitorConfig.setRequestHeadersToSend(
                    requestHeaders.split(","));
        }
        urlMonitorConfig.setUsername(configuration.getString(CK_CONFIG_USER_NAME));
        urlMonitorConfig.setPassword(configuration.getString(CK_CONFIG_PASSWORD));
        urlMonitorConfig.setExecutionInterval(configuration.getInt(CK_CONFIG_INTERVAL));
        urlMonitorConfig.setTimeout(configuration.getInt(CK_CONFIG_TIMEOUT));
        urlMonitorConfig.setTimeoutUnit(TimeUnit.valueOf(configuration.getString(CK_CONFIG_TIMEOUT_UNIT)));
        urlMonitorConfig.setIntervalUnit(TimeUnit.valueOf(configuration.getString(CK_CONFIG_INTERVAL_UNIT)));

//        long timoutInMs = TimeUnit.MILLISECONDS.convert(urlMonitorConfig.getTimeout(), urlMonitorConfig.getTimeoutUnit());
//        long intervalInMs = TimeUnit.MILLISECONDS.convert(urlMonitorConfig.getExecutionInterval(), urlMonitorConfig.getIntervalUnit());
//
//        if (intervalInMs <= timoutInMs) {
//            String message = MessageFormat.format("Timeout {0} {1} should be smaller than interval {2} {3}",
//                    urlMonitorConfig.getTimeout(),urlMonitorConfig.getTimeoutUnit(),
//                    urlMonitorConfig.getExecutionInterval(), urlMonitorConfig.getIntervalUnit());
//            throw new MisfireException(message);
//        }

        urlMonitorConfig.setRequestBody(configuration.getString(CK_CONFIG_REQUEST_BODY));
        urlMonitorConfig.setLogResponseBody(configuration.getBoolean(CK_CONFIG_LOG_RESPONSE_BODY));

        String responseHeaders = configuration.getString(CK_CONFIG_HEADERS_TO_RECORD);
        if (StringUtils.isNotEmpty(responseHeaders)) {
            urlMonitorConfig.setResponseHeadersToRecord(
                    responseHeaders.split(","));
        }

        startMonitoring(urlMonitorConfig);
    }
 
开发者ID:sivasamyk,项目名称:graylog2-plugin-input-httpmonitor,代码行数:47,代码来源:HttpMonitorTransport.java


示例11: launch

import org.graylog2.plugin.inputs.MisfireException; //导入依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
    serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));
    serverEventBus.register(this);

    LOG.debug("Launching MongoDB profiler reader.");
    final Configuration configuration = input.getConfiguration();

    final int port = configuration.getInt(CK_MONGO_PORT);
    final MongoClient mongoClient;
    final List<MongoCredential> credentialList;
    final String db = configuration.getString(CK_MONGO_DB);
    if (configuration.getBoolean(CK_MONGO_USE_AUTH)) {
        final MongoCredential credentials = MongoCredential.createCredential(
                configuration.getString(CK_MONGO_USER),
                db,
                configuration.getString(CK_MONGO_PW).toCharArray()
        );

        credentialList = ImmutableList.of(credentials);
    } else {
        credentialList = ImmutableList.of();
    }

    final String mongoHost = configuration.getString(CK_MONGO_HOST);
    final String[] hosts = mongoHost.split(",");
    final List<ServerAddress> replicaHosts = new ArrayList<>(hosts.length);
    for (String host : hosts) {
        replicaHosts.add(new ServerAddress(host, port));
    }
    mongoClient = new MongoClient(replicaHosts, credentialList);

    // Try the connection.
    try {
        mongoClient.getDB(db).getStats();
    } catch (Exception e) {
        throw new MisfireException("Could not verify MongoDB profiler connection.", e);
    }

    subscriber = new ProfileSubscriber(mongoClient, db, input, localRegistry);
    subscriber.start();
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-mongodb-profiler,代码行数:43,代码来源:MongoDBProfilerTransport.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TridentKafkaConfig类代码示例发布时间:2022-05-22
下一篇:
Java ClientResponseFailure类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap