代码之家  ›  专栏  ›  技术社区  ›  BetaRide

部署Spring云数据流本地服务器

  •  0
  • BetaRide  · 技术社区  · 7 年前

    Getting Started with Manual Installation .

    我可以下载并启动 Spring云数据流本地服务器 Spring云数据流外壳

    然后我继续 Deploying Streams

    Welcome to the Spring Cloud Data Flow shell. For assistance hit TAB or type "help".
    dataflow:>app register --name http --type source --uri maven://org.springframework.cloud.stream.app:http-source-rabbit:1.2.0.RELEASE
    Successfully registered application 'source:http'
    dataflow:>app register --name log --type sink --uri maven://org.springframework.cloud.stream.app:log-sink-rabbit:1.1.0.RELEASE
    Successfully registered application 'sink:log'
    

    然后,我尝试使用以下内容创建流:

    dataflow:>stream create --name httptest --definition "http --server.port=9000 | log" --deploy
    Created new stream 'httptest'
    Deployment request has been sent
    

    然后发送一些数据,但失败:

    dataflow:>http post --target http://localhost:9000 --data "hello world"
    > POST (text/plain) http://localhost:9000 hello world
    > 500 INTERNAL_SERVER_ERROR
    > 500 INTERNAL_SERVER_ERROR
    {
      "exception" : "org.springframework.messaging.MessageHandlingException",
      "path" : "/",
      "error" : "Internal Server Error",
      "message" : "error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint@20eacb00]; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)",
      "timestamp" : 1546968872545,
      "status" : 500
    }
    Error sending data 'hello world' to 'http://localhost:9000'
    

    我可以从地图上看到 log file 在日志应用程序中,发生了一些错误。但是作为一个初学者,我真的不知道如何继续或解决这个问题。

    有什么想法吗?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Sabby Anandan    7 年前

    查看此错误:

    消息处理程序[org.springframework.integration.amqp.outbound]中出错。AmqpOutboundEndpoint@20eacb00]; 嵌套异常为org.springframework.amqp.AmqpConnectException:java.net.ConnectException:connect-densed(连接拒绝)

    您似乎没有本地运行RabbitMQ。在部署流时,如果现在启动RabbitMQ实例,应用程序将自动恢复并连接到它。然后你会看到应用程序的成功部署,帖子最终也会起作用。

    MessageBroker是一个Spring云流 要求 . 这就是事件驱动的微服务通过pub-sub语义相互通信的方式。更多详细信息,请访问Spring cloud Stream ref. guide

    如果您想知道SCDF的作用,以下是一些背景:

    SCDF仅仅是一种编排服务。当SCDF的本地实现部署流时,流中的应用程序将作为独立的Java进程生成。它们是Spring Boot应用程序。在启动时,他们尝试自动配置底层绑定器实现库类路径。在您的示例中,您注册的应用程序与rabbit binder捆绑在一起,因为它们没有配置为连接到外部RabbitMQ群集,所以应用程序将尝试连接到默认连接属性(即“localhost”和默认“port”)。

    您可以选择RabbitMQ或Kafka,也可以 customize 任何与其他应用程序通信的现成应用程序 binder implementations .

    这是一个 example 用于在SCDF中将Apache Kafka用作绑定器实现时。