小编Bil*_*erg的帖子

通过不同的线程使用Kafka Producer

我有基于java的Web应用程序的kafka生产者将消息推送到Kafka.根据文档,我可以看到kafka生产者是线程安全的.这是否意味着我可以拥有Kafka生产者的单个实例,并通过不同的线程(Web请求)使用它们,每个都将在我的情况下打开和关闭生产者.这会产生任何问题吗?或者最好根据请求启动生产者?

apache-kafka kafka-producer-api

10
推荐指数
1
解决办法
7715
查看次数

安装 python-ldap 失败,即使在安装开发包后,在 ubuntu 17.10 中找不到 lber.h 文件

我正在尝试使用 pip 安装 python-ldap 包。执行时出现以下错误pip install python-ldap。我尝试根据此问题安装与 ubuntu 17.10 ( Artful ) 对应的软件包,但还没有运气。我错过了什么包裹?

上述堆栈溢出问题中的解决方案是安装 sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev 但在 17.10 中我看不到libsasl2-dev&libldap2-dev而是我可以看到包libsasl-2-2& libldap-2.4-2。我和phthon-dev&一起安装了它们libssl-dev。但我仍然收到以下错误。似乎我缺少一些包含 lber.h 文件的软件包安装。

我得到的错误:

 In file included from Modules/LDAPObject.c:8:0:
    Modules/constants.h:7:10: fatal error: lber.h: No such file or directory
     #include "lber.h"
              ^~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Run Code Online (Sandbox Code Playgroud)

Python 版本 - 3.6.3

点子版本 - 19.1.1

pip python-ldap python-3.6 ubuntu-17.10

7
推荐指数
2
解决办法
7037
查看次数

Spring AWS Cloud SNS HTTP端点确认订阅不起作用

在我的春季启动aws-cloud SNS http端点中,确认订阅不起作用。当SNS确认到来时,以下错误出现在我的应用程序中。错误:

[Request processing failed; nested exception is java.lang.IllegalArgumentException: Invoked method public abstract void org.springframework.cloud.aws.messaging.endpoint.NotificationStatus.confirmSubscription() is no accessor method!] with root cause
    java.lang.IllegalArgumentException: Invoked method public abstract void org.springframework.cloud.aws.messaging.endpoint.NotificationStatus.confirmSubscription() is no accessor method!
        at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.4.RELEASE.jar!/:4.2.4.RELEASE]
        at org.spring
Run Code Online (Sandbox Code Playgroud)

我的控制器处理程序是:

     @NotificationSubscriptionMapping
        public void handleSubscriptionMessage( NotificationStatus status)   throws IOException {
            //Confirming SNS subscription
            status.confirmSubscription();
        }
Run Code Online (Sandbox Code Playgroud)

我的Pom包含以下内容:

     <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-aws-messaging</artifactId>
          <version>1.0.4.RELEASE</version>
        </dependency>

        <!-- For Spring AWS autoconfiguration-->
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-aws-autoconfigure</artifactId>
          <version>1.0.4.RELEASE</version>
        </dependency>
Run Code Online (Sandbox Code Playgroud)

我按照此链接中的说明进行操作

java spring spring-boot spring-cloud

5
推荐指数
1
解决办法
1181
查看次数

spring aws 云 SNS 端点参数解析器的 Java 配置

我正在努力为我的 spring aws 云 SNS http 端点找到相当于以下 xml 配置的 spring boot java 配置。有人可以帮忙吗?

<mvc:annotation-driven>
        <mvc:argument-resolvers>
            <ref bean="notificationResolver" />
        </mvc:argument-resolvers>
       </mvc:annotation-driven>
     <aws-messaging:notification-argument-resolver id="notificationResolver" />
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-cloud

5
推荐指数
1
解决办法
929
查看次数

使用Java Spring Cloud AWS确认SNS通知时出现InvalidParameterException

我有使用Spring-aws-cloud编写的SNS http端点。我遵循以下教程。当我从SNS主题请求确认时,我从应用程序控制台收到以下错误。似乎status.confirmSubscription()失败。我得到的错误是:

zonaws.services.sns.model.InvalidParameterException: Invalid parameter: TopicArn (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: d47581bd-789f-58f0-b976-ced91fec6929)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1383) ~[aws-java-sdk-core-1.10.61.jar:na]
        at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:902) ~[aws-java-sdk-core-1.10.61.jar:na]
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:607) ~[aws-java-sdk-core-1.10.61.jar:na]
        at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:376) ~[aws-java-sdk-core-1.10.61.jar:na]
        at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:338) ~[aws-java-sdk-core-1.10.61.jar:na]
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:287) ~[aws-java-sdk-core-1.10.61.jar:na]
        at com.amazonaws.services.sns.AmazonSNSClient.invoke(AmazonSNSClient.java:2459) ~[aws-java-sdk-sns-1.10.7.jar:na]
        at com.amazonaws.services.sns.AmazonSNSClient.confirmSubscription(AmazonSNSClient.java:284) ~[aws-java-sdk-sns-1.10.7.jar:na]
        at com.amazonaws.services.sns.AmazonSNSClient.confirmSubscription(AmazonSNSClient.java:1761) ~[aws-java-sdk-sns-1.10.7.jar:na]
        at org.springframework.cloud.aws.messaging.endpoint.NotificationStatusHandlerMethodArgumentResolver$AmazonSnsNotificationStatus.confirmSubscription(NotificationStatusHandlerMethodArgumentResolver.java:62) ~[spring-cloud-aws-messaging-1.0.4.RELEASE.jar:1.0.4.RELEASE]
        at com.fastretailing.catalogPlatformSCMProducer.controller.SNSController.handleSubscriptionMessage(SNSController.java:73) ~[classes/:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE] …
Run Code Online (Sandbox Code Playgroud)

spring amazon-web-services aws-sdk spring-cloud

5
推荐指数
2
解决办法
6580
查看次数

Javascript websocket客户端库,可以在握手请求中传递自定义标头

我需要一个javascript库连接到我的web-socket服务器,这是使用python twisted实现的.我尝试了Native javascript web-socket客户端,但它没有根据此链接传递自定义标头的选项.我的Web套接字服务器通过从Oauth2标准中的握手头中获取auth_token来进行身份验证.是否有任何javascript库可用于Web套接字客户端,允许在连接时传递自定义标头?

javascript websocket

3
推荐指数
1
解决办法
9156
查看次数

Filebeat 与直接从应用程序将日志推送到 Logstash

我计划为我们的一个项目构建一个集中式日志系统,该项目有多个用 Java、Python 和 Scala 编写的组件。我想从不同部分(REST 服务器、Spark 作业、Airflow 服务器)收集日志以记录到 Elastic 搜索中并建立索引。我可以看到PythonJava日志记录模块中都有直接库可以将日志从应用程序直接推送到 Logstash。我可以看到 filebeat 可以在服务器上配置,将日志从文件推送到logstash。使用 filebeat 比直接将日志发送到 Logstash 有什么优势?最佳实践是什么?

java python-3.x logstash filebeat

3
推荐指数
1
解决办法
3400
查看次数

如果先前的任务执行需要更多时间,则气流计划将被跳过

我的气流 DAG 中有两个任务。一个触发 API 调用(Http 运算符),另一个使用另一个 API(Http 传感器)不断检查其状态。该 DAG 计划每小时 10 分钟运行一次。但有时一次执行可能需要很长时间才能完成,例如 20 小时。在这种情况下,上一个任务运行时的所有计划都不会执行。

例如,假设我 01:10 的工作需要 10 个小时才能完成。原本应该运行的 02:10、03:10、04:10、... 11:10 等时间表被跳过,只执行 12:10 的时间表。

我正在使用本地执行器。我正在使用下面的脚本运行气流服务器和调度程序。 start_server.sh

export AIRFLOW_HOME=./airflow_home;
export AIRFLOW_GPL_UNIDECODE=yes;
export AIRFLOW_CONN_REST_API=http://localhost:5000;
export AIRFLOW_CONN_MANAGEMENT_API=http://localhost:8001;
airflow initdb;
airflow webserver -p 7200;
Run Code Online (Sandbox Code Playgroud)

start_scheduler.sh

export AIRFLOW_HOME=./airflow_home;
# Connection string for connecting to REST interface server
export AIRFLOW_CONN_REST_API=http://localhost:5000;
export AIRFLOW_CONN_MANAGEMENT_API=http://localhost:8001;
#export AIRFLOW__SMTP__SMTP_PASSWORD=**********;
airflow scheduler;
Run Code Online (Sandbox Code Playgroud)

my_dag_file.py

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': airflow.utils.dates.days_ago(2),
    'email': admin_email_ids,
    'email_on_failure': False,
    'email_on_retry': False

}

DAG_ID = 'reconciliation_job_pipeline' …
Run Code Online (Sandbox Code Playgroud)

airflow airflow-scheduler

3
推荐指数
1
解决办法
3233
查看次数

使用 imagemagick 将图像转换为铅笔画(不是铅笔草图)

我需要一个像艺术家一样将任何图像转换为铅笔画(不是草图)的应用程序。与本问题中步骤 1 中的步骤 2 完全相同。我尝试过以下选项。

1-满足我的要求的最佳方法是什么?

2- 我们在 cany 检测中用参数字符串指定什么0x1+10%+20%

3-如何去除复印中的铅笔阴影并仅获得重要的轮廓?

4-还有其他最适合的图像编辑工具吗?

python imagemagick

0
推荐指数
1
解决办法
5733
查看次数