1. 首先, 在 ~/.m2/settings.xml中添加远程仓库配置:
 <repositories>
 ...
        <repository>
          <id>central</id>
          <layout>default</layout>
          <url>https://repo1.maven.org/maven2</url>
        </repository>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>bintray-yahoo-maven</id>
          <name>bintray</name>
          <url>https://yahoo.bintray.com/maven</url>
        </repository>
....
</repositories>
  1. 这里使用Intellij进行调试. 相关配置:
  • 启动类: org.apache.pulsar.PulsarStandaloneStarter
  • 启动参数: –config conf/standalone.conf –no-functions-worker
  1. intellij 启动成功后, 本地使用 consumer&producer测试.

    • 启动consumer: bin/pulsar-client consume my-topic -t Shared -s demo-sub2 -n 1

    • 启动produer: bin/pulsar-client produce my-topic –messages “hello-pulsar” producer启动成功后, consumer控制面上会有 消息提示.

      ----- got message -----
      hello-pulsar